T
- event implementation storing the data for sharing during exchange or parallel coordination of an event.public final class AggregateEventHandler<T> extends java.lang.Object implements EventHandler<T>, LifecycleAware
EventHandler
s that get called in sequence for each event.Modifier and Type | Field and Description |
---|---|
private EventHandler<T>[] |
eventHandlers |
Constructor and Description |
---|
AggregateEventHandler(EventHandler<T>... eventHandlers)
Construct an aggregate collection of
EventHandler s to be called in sequence. |
Modifier and Type | Method and Description |
---|---|
void |
onEvent(T event,
long sequence,
boolean endOfBatch)
Called when a publisher has published an event to the
RingBuffer |
void |
onShutdown()
Called once just before the thread is shutdown.
|
void |
onStart()
Called once on thread start before first event is available.
|
private final EventHandler<T>[] eventHandlers
public AggregateEventHandler(EventHandler<T>... eventHandlers)
EventHandler
s to be called in sequence.eventHandlers
- to be called in sequence.public void onEvent(T event, long sequence, boolean endOfBatch) throws java.lang.Exception
EventHandler
RingBuffer
onEvent
in interface EventHandler<T>
event
- published to the RingBuffer
sequence
- of the event being processedendOfBatch
- flag to indicate if this is the last event in a batch from the RingBuffer
java.lang.Exception
- if the EventHandler would like the exception handled further up the chain.public void onStart()
LifecycleAware
onStart
in interface LifecycleAware
public void onShutdown()
LifecycleAware
Called once just before the thread is shutdown.
Sequence event processing will already have stopped before this method is called. No events will be processed after this message.
onShutdown
in interface LifecycleAware