Class EgressAdapter

java.lang.Object
io.aeron.cluster.client.EgressAdapter
All Implemented Interfaces:
FragmentHandler

public final class EgressAdapter extends Object implements FragmentHandler
Adapter for dispatching egress messages from a cluster to a EgressListener.
  • 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 the EgressListener.
      Parameters:
      listener - to dispatch events to.
      clusterSessionId - for the egress.
      subscription - over the egress stream.
      fragmentLimit - to poll on each poll() 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 the EgressListener or extension messages to EgressListenerExtension.
      Parameters:
      listener - to dispatch events to.
      listenerExtension - to dispatch extension messages to
      clusterSessionId - for the egress.
      subscription - over the egress stream.
      fragmentLimit - to poll on each poll() operation.
  • Method Details

    • poll

      public int poll()
      Poll the egress subscription and dispatch assembled events to the EgressListener.
      Returns:
      the number of fragments consumed.
    • onFragment

      public void 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 Aeron client are not permitted and will result in undefined behaviour.

      Specified by:
      onFragment in interface FragmentHandler
      Parameters:
      buffer - containing the data.
      offset - at which the data begins.
      length - of the data in bytes.
      header - representing the metadata for the data.