Class RecordingEventsPoller

java.lang.Object
io.aeron.archive.client.RecordingEventsPoller
All Implemented Interfaces:
ControlledFragmentHandler

public final class RecordingEventsPoller extends Object implements ControlledFragmentHandler
Encapsulate the polling and decoding of recording events.
  • Constructor Details

    • RecordingEventsPoller

      public RecordingEventsPoller(Subscription subscription)
      Create a poller for a given subscription to an archive for recording events.
      Parameters:
      subscription - to poll for new events.
  • Method Details

    • poll

      public int poll()
      Poll for recording events.
      Returns:
      the number of fragments read during the operation. Zero if no events are available.
    • isPollComplete

      public boolean isPollComplete()
      Has the last polling action received a complete message?
      Returns:
      true of the last polling action received a complete message?
    • templateId

      public int templateId()
      Get the template id of the last received message.
      Returns:
      the template id of the last received message.
    • recordingId

      public long recordingId()
      Get the recording id of the last received event.
      Returns:
      the recording id of the last received event.
    • recordingStartPosition

      public long recordingStartPosition()
      Get the position the recording started at.
      Returns:
      the position the recording started at.
    • recordingPosition

      public long recordingPosition()
      Get the current recording position.
      Returns:
      the current recording position.
    • recordingStopPosition

      public long recordingStopPosition()
      Get the position the recording stopped at.
      Returns:
      the position the recording stopped at.
    • 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.