Class EventProcessorTask

java.lang.Object
org.axonframework.eventhandling.async.EventProcessorTask
All Implemented Interfaces:
Runnable

public class EventProcessorTask extends Object implements Runnable
Scheduler that keeps track of (Event processing) tasks that need to be executed sequentially.
Since:
1.0
Author:
Allard Buijze
  • Constructor Details

    • EventProcessorTask

      public EventProcessorTask(Executor executor, EventProcessorTask.ShutdownCallback shutDownCallback)
      Initialize a scheduler using the given executor. This scheduler uses an unbounded queue to schedule events.
      Parameters:
      executor - The executor service that will process the events
      shutDownCallback - The callback to notify when the scheduler finishes processing events
  • Method Details

    • scheduleEvents

      public boolean scheduleEvents(List<? extends EventMessage<?>> events, Consumer<List<? extends EventMessage<?>>> processor)
      Schedules a batch of events for processing. Will schedule a new invoker task if none is currently active.

      If the current scheduler is in the process of being shut down, this method will return false.

      This method is thread safe.

      Parameters:
      events - the events to schedule
      processor - the component that will do the actual processing of the events
      Returns:
      true if the event was scheduled successfully, false if this scheduler is not available to process events
      Throws:
      IllegalStateException - if the queue in this scheduler does not have the capacity to add this event
    • run

      public void run()
      Specified by:
      run in interface Runnable