public class AsynchronousEventProcessingStrategy extends Object implements EventProcessingStrategy
EventProcessingStrategythat creates event processing tasks for asynchronous execution. Clients can decide if events may be processed in sequence or in parallel using a
|Constructor and Description|
Initializes a new
|Modifier and Type||Method and Description|
Handle the given batch of
Creates a new scheduler instance that schedules tasks on the executor service for the managed EventListener.
Schedules this task for execution when all pre-conditions have been met.
public AsynchronousEventProcessingStrategy(Executor executor, SequencingPolicy<? super EventMessage<?>> sequencingPolicy)
AsynchronousEventProcessingStrategythat uses the given
executorto execute event processing tasks and
sequencingPolicythat determines if an event may be processed in sequence or in parallel.
executor- the event processing job executor
sequencingPolicy- the policy that determines if an event may be processed in sequence or in parallel
public void handle(List<? extends EventMessage<?>> events, Consumer<List<? extends EventMessage<?>>> processor)
events. Once the strategy decides it is opportune to process the events it should pass them back to the given
Note that the strategy may call back to the processor more than once for a single invocation of this method. Also note that a batch of events passed back to the processor may be made up of events from different batches.
protected void schedule(List<? extends EventMessage<?>> events, Consumer<List<? extends EventMessage<?>>> processor)
events- The messages to schedule for processing
processor- The component that will perform the actual processing
protected EventProcessorTask newProcessingScheduler(EventProcessorTask.ShutdownCallback shutDownCallback)
shutDownCallback- The callback that needs to be notified when the scheduler stops processing.
Copyright © 2010–2020. All rights reserved.