Package io.aeron
Class DriverProxy
java.lang.Object
io.aeron.DriverProxy
Separates the concern of communicating with the client conductor away from the rest of the client.
For writing commands into the client conductor buffer.
Note: this class is not thread safe and is expecting to be called within Aeron.Context.clientLock().
-
Constructor Summary
ConstructorsConstructorDescriptionDriverProxy(RingBuffer toDriverCommandBuffer, long clientId) Create a proxy to a media driver which sends commands via aRingBuffer. -
Method Summary
Modifier and TypeMethodDescriptionlongaddCounter(int typeId, String label) Add a new counter with a type id and label, the key will be blank.longaddCounter(int typeId, DirectBuffer keyBuffer, int keyOffset, int keyLength, DirectBuffer labelBuffer, int labelOffset, int labelLength) Add a new counter with a type id plus the label and key are provided in buffers.longaddDestination(long registrationId, String endpointChannel) Add a destination to the send channel of an existing MDC Publication.longaddExclusivePublication(String channel, int streamId) Instruct the driver to add a non-concurrent, i.e.longaddPublication(String channel, int streamId) Instruct the driver to add a concurrent publication.longaddRcvDestination(long registrationId, String endpointChannel) Add a destination to the receive channel endpoint of an existing MDS Subscription.longaddSubscription(String channel, int streamId) Instruct the driver to add a subscription.voidNotify the media driver that this client is closing.longrejectImage(long imageCorrelationId, long position, String reason) Reject a specific image.longremoveCounter(long registrationId) Instruct the media driver to remove an existing counter by its registration id.longremoveDestination(long publicationRegistrationId, long destinationRegistrationId) Remove a destination from the send channel of an existing MDC Publication.longremoveDestination(long registrationId, String endpointChannel) Remove a destination from the send channel of an existing MDC Publication.longremovePublication(long registrationId, boolean revoke) Instruct the driver to remove a publication by its registration id.longremoveRcvDestination(long registrationId, String endpointChannel) Remove a destination from the receive channel endpoint of an existing MDS Subscription.longremoveSubscription(long registrationId) Instruct the driver to remove a subscription by its registration id.booleanterminateDriver(DirectBuffer tokenBuffer, int tokenOffset, int tokenLength) Instruct the media driver to terminate.longTime of the last heartbeat to indicate the driver is alive.toString()
-
Constructor Details
-
DriverProxy
Create a proxy to a media driver which sends commands via aRingBuffer.- Parameters:
toDriverCommandBuffer- to send commands via.clientId- to represent the client.
-
-
Method Details
-
timeOfLastDriverKeepaliveMs
public long timeOfLastDriverKeepaliveMs()Time of the last heartbeat to indicate the driver is alive.- Returns:
- time of the last heartbeat to indicate the driver is alive.
-
addPublication
Instruct the driver to add a concurrent publication.- Parameters:
channel- uri in string format.streamId- within the channel.- Returns:
- the correlation id for the command.
-
addExclusivePublication
Instruct the driver to add a non-concurrent, i.e. exclusive, publication.- Parameters:
channel- uri in string format.streamId- within the channel.- Returns:
- the correlation id for the command.
-
removePublication
public long removePublication(long registrationId, boolean revoke) Instruct the driver to remove a publication by its registration id.- Parameters:
registrationId- for the publication to be removed.revoke- whether the publication is being revoked.- Returns:
- the correlation id for the command.
-
addSubscription
Instruct the driver to add a subscription.- Parameters:
channel- uri in string format.streamId- within the channel.- Returns:
- the correlation id for the command.
-
removeSubscription
public long removeSubscription(long registrationId) Instruct the driver to remove a subscription by its registration id.- Parameters:
registrationId- for the subscription to be removed.- Returns:
- the correlation id for the command.
-
addDestination
Add a destination to the send channel of an existing MDC Publication.- Parameters:
registrationId- of the Publication.endpointChannel- for the destination.- Returns:
- the correlation id for the command.
-
removeDestination
Remove a destination from the send channel of an existing MDC Publication.- Parameters:
registrationId- of the Publication.endpointChannel- used for theaddDestination(long, String)command.- Returns:
- the correlation id for the command.
-
removeDestination
public long removeDestination(long publicationRegistrationId, long destinationRegistrationId) Remove a destination from the send channel of an existing MDC Publication.- Parameters:
publicationRegistrationId- of the Publication.destinationRegistrationId- used for theaddDestination(long, String)command.- Returns:
- the correlation id for the command.
-
addRcvDestination
Add a destination to the receive channel endpoint of an existing MDS Subscription.- Parameters:
registrationId- of the Subscription.endpointChannel- for the destination.- Returns:
- the correlation id for the command.
-
removeRcvDestination
Remove a destination from the receive channel endpoint of an existing MDS Subscription.- Parameters:
registrationId- of the Subscription.endpointChannel- used for theaddRcvDestination(long, String)command.- Returns:
- the correlation id for the command.
-
addCounter
public long addCounter(int typeId, DirectBuffer keyBuffer, int keyOffset, int keyLength, DirectBuffer labelBuffer, int labelOffset, int labelLength) Add a new counter with a type id plus the label and key are provided in buffers.- Parameters:
typeId- for associating with the counter.keyBuffer- containing the metadata key.keyOffset- offset at which the key begins.keyLength- length in bytes for the key.labelBuffer- containing the label.labelOffset- offset at which the label begins.labelLength- length in bytes for the label.- Returns:
- the correlation id for the command.
-
addCounter
Add a new counter with a type id and label, the key will be blank.- Parameters:
typeId- for associating with the counter.label- that is human-readable for the counter.- Returns:
- the correlation id for the command.
-
removeCounter
public long removeCounter(long registrationId) Instruct the media driver to remove an existing counter by its registration id.- Parameters:
registrationId- of counter to remove.- Returns:
- the correlation id for the command.
-
clientClose
public void clientClose()Notify the media driver that this client is closing. -
terminateDriver
Instruct the media driver to terminate.- Parameters:
tokenBuffer- containing the authentication token.tokenOffset- at which the token begins.tokenLength- in bytes.- Returns:
- true is successfully sent.
-
rejectImage
Reject a specific image.- Parameters:
imageCorrelationId- of the image to be invalidatedposition- of the image when invalidation occurredreason- user supplied reason for invalidation, reported back to publication- Returns:
- the correlationId of the request for invalidation.
-
toString
-