Package io.aeron.cluster.client
Class ControlledEgressAdapter
java.lang.Object
io.aeron.cluster.client.ControlledEgressAdapter
- All Implemented Interfaces:
ControlledFragmentHandler
Adapter for dispatching egress messages from a cluster to a
ControlledEgressListener.-
Nested Class Summary
Nested classes/interfaces inherited from interface io.aeron.logbuffer.ControlledFragmentHandler
ControlledFragmentHandler.Action -
Constructor Summary
ConstructorsConstructorDescriptionControlledEgressAdapter(ControlledEgressListener listener, long clusterSessionId, Subscription subscription, int fragmentLimit) Construct an adapter for cluster egress which consumes from the subscription and dispatches to theControlledEgressListener.ControlledEgressAdapter(ControlledEgressListener listener, ControlledEgressListenerExtension listenerExtension, long clusterSessionId, Subscription subscription, int fragmentLimit) Construct an adapter for cluster egress which consumes from the subscription and dispatches to theControlledEgressListeneror extension messages toControlledEgressListenerExtension. -
Method Summary
Modifier and TypeMethodDescriptiononFragment(DirectBuffer buffer, int offset, int length, Header header) Callback for handling fragments of data being read from a log.intpoll()Poll the egress subscription and dispatch assembled events to theControlledEgressListener.
-
Constructor Details
-
ControlledEgressAdapter
public ControlledEgressAdapter(ControlledEgressListener listener, long clusterSessionId, Subscription subscription, int fragmentLimit) Construct an adapter for cluster egress which consumes from the subscription and dispatches to theControlledEgressListener.- Parameters:
listener- to dispatch events to.clusterSessionId- for the egress.subscription- over the egress stream.fragmentLimit- to poll on eachpoll()operation.
-
ControlledEgressAdapter
public ControlledEgressAdapter(ControlledEgressListener listener, ControlledEgressListenerExtension listenerExtension, long clusterSessionId, Subscription subscription, int fragmentLimit) Construct an adapter for cluster egress which consumes from the subscription and dispatches to theControlledEgressListeneror extension messages toControlledEgressListenerExtension.- Parameters:
listener- to dispatch events to.listenerExtension- to dispatch extension messages toclusterSessionId- for the egress.subscription- over the egress stream.fragmentLimit- to poll on eachpoll()operation.
-
-
Method Details
-
poll
public int poll()Poll the egress subscription and dispatch assembled events to theControlledEgressListener.- Returns:
- the number of fragments consumed.
-
onFragment
public ControlledFragmentHandler.Action onFragment(DirectBuffer buffer, int offset, int length, Header header) Callback for handling fragments of data being read from a log.Within this callback reentrant calls to the
Aeronclient are not permitted and will result in undefined behaviour.- Specified by:
onFragmentin interfaceControlledFragmentHandler- Parameters:
buffer- containing the data.offset- at which the data begins.length- of the data in bytes.header- representing the metadata for the data.- Returns:
- The action to be taken with regard to the stream position after the callback.
-