Interface RewindableEventHandler<T>

Type Parameters:
T - event implementation storing the data for sharing during exchange or parallel coordination of an event.
All Superinterfaces:
EventHandlerBase<T>, EventHandlerIdentity

public interface RewindableEventHandler<T> extends EventHandlerBase<T>
Callback interface to be implemented for processing events as they become available in the RingBuffer with support for throwing a RewindableException when an even cannot be processed currently but may succeed on retry.
See Also:
  • Method Details

    • onEvent

      void onEvent(T event, long sequence, boolean endOfBatch) throws RewindableException, Exception
      Called when a publisher has published an event to the RingBuffer. The BatchEventProcessor will read messages from the RingBuffer in batches, where a batch is all of the events available to be processed without having to wait for any new event to arrive. This can be useful for event handlers that need to do slower operations like I/O as they can group together the data from multiple events into a single operation. Implementations should ensure that the operation is always performed when endOfBatch is true as the time between that message and the next one is indeterminate.
      Specified by:
      onEvent in interface EventHandlerBase<T>
      Parameters:
      event - published to the RingBuffer
      sequence - of the event being processed
      endOfBatch - flag to indicate if this is the last event in a batch from the RingBuffer
      Throws:
      RewindableException - if the EventHandler would like the batch event processor to process the entire batch again.
      Exception - if the EventHandler would like the exception handled further up the chain.