Package io.aeron.cluster.client
Class EgressAdapter
java.lang.Object
io.aeron.cluster.client.EgressAdapter
- All Implemented Interfaces:
FragmentHandler
Adapter for dispatching egress messages from a cluster to a
EgressListener.-
Constructor Summary
ConstructorsConstructorDescriptionEgressAdapter(EgressListener listener, long clusterSessionId, Subscription subscription, int fragmentLimit) Construct an adapter for cluster egress which consumes from the subscription and dispatches to theEgressListener.EgressAdapter(EgressListener listener, EgressListenerExtension listenerExtension, long clusterSessionId, Subscription subscription, int fragmentLimit) Construct an adapter for cluster egress which consumes from the subscription and dispatches to theEgressListeneror extension messages toEgressListenerExtension. -
Method Summary
Modifier and TypeMethodDescriptionvoidonFragment(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 theEgressListener.
-
Constructor Details
-
EgressAdapter
public EgressAdapter(EgressListener listener, long clusterSessionId, Subscription subscription, int fragmentLimit) Construct an adapter for cluster egress which consumes from the subscription and dispatches to theEgressListener.- Parameters:
listener- to dispatch events to.clusterSessionId- for the egress.subscription- over the egress stream.fragmentLimit- to poll on eachpoll()operation.
-
EgressAdapter
public EgressAdapter(EgressListener listener, EgressListenerExtension listenerExtension, long clusterSessionId, Subscription subscription, int fragmentLimit) Construct an adapter for cluster egress which consumes from the subscription and dispatches to theEgressListeneror extension messages toEgressListenerExtension.- 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 theEgressListener.- Returns:
- the number of fragments consumed.
-
onFragment
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 interfaceFragmentHandler- Parameters:
buffer- containing the data.offset- at which the data begins.length- of the data in bytes.header- representing the metadata for the data.
-