Class ControlledEgressAdapter

java.lang.Object
io.aeron.cluster.client.ControlledEgressAdapter
All Implemented Interfaces:
ControlledFragmentHandler

public final class ControlledEgressAdapter extends Object implements ControlledFragmentHandler
Adapter for dispatching egress messages from a cluster to a ControlledEgressListener.
  • 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 the ControlledEgressListener.
      Parameters:
      listener - to dispatch events to.
      clusterSessionId - for the egress.
      subscription - over the egress stream.
      fragmentLimit - to poll on each poll() 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 the ControlledEgressListener or extension messages to ControlledEgressListenerExtension.
      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 ControlledEgressListener.
      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 Aeron client are not permitted and will result in undefined behaviour.

      Specified by:
      onFragment in interface ControlledFragmentHandler
      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.