org.axonframework.eventhandling
Class EventProcessingScheduler

java.lang.Object
  extended by org.axonframework.eventhandling.EventProcessingScheduler
All Implemented Interfaces:
Runnable

public class EventProcessingScheduler
extends Object
implements Runnable

The EventProcessingScheduler is responsible for scheduling all events within the same SequencingIdentifier in an Executor. It will only handle events that were present in the queue at the moment processing started. Any events added later will be rescheduled automatically.

Since:
0.3
Author:
Allard Buijze

Constructor Summary
EventProcessingScheduler(EventListener eventListener, TransactionManager transactionManager, Executor executor, org.axonframework.eventhandling.EventProcessingScheduler.ShutdownCallback shutDownCallback)
          Initialize a scheduler for the given eventListener using the given executor.
EventProcessingScheduler(EventListener eventListener, TransactionManager transactionManager, Executor executor, Queue<Event> eventQueue, org.axonframework.eventhandling.EventProcessingScheduler.ShutdownCallback shutDownCallback)
          Initialize a scheduler for the given eventListener using the given executor.
 
Method Summary
 void run()
          
 boolean scheduleEvent(Event event)
          Schedules an event for processing.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EventProcessingScheduler

public EventProcessingScheduler(EventListener eventListener,
                                TransactionManager transactionManager,
                                Executor executor,
                                org.axonframework.eventhandling.EventProcessingScheduler.ShutdownCallback shutDownCallback)
Initialize a scheduler for the given eventListener using the given executor.

Parameters:
eventListener - The event listener for which this scheduler schedules events
transactionManager - The transaction manager that manages underlying transactions
executor - The executor service that will process the events
shutDownCallback - The callback to notify when the scheduler finishes processing events

EventProcessingScheduler

public EventProcessingScheduler(EventListener eventListener,
                                TransactionManager transactionManager,
                                Executor executor,
                                Queue<Event> eventQueue,
                                org.axonframework.eventhandling.EventProcessingScheduler.ShutdownCallback shutDownCallback)
Initialize a scheduler for the given eventListener using the given executor. The eventQueue is the queue from which the scheduler should obtain it's events. This queue must be thread safe, as it can be used simultaneously by multiple threads.

Parameters:
eventListener - The event listener for which this scheduler schedules events
transactionManager - The transaction manager that manages underlying transactions
executor - The executor service that will process the events
eventQueue - The queue from which this scheduler gets events
shutDownCallback - The callback to notify when the scheduler finishes processing events
Method Detail

scheduleEvent

public boolean scheduleEvent(Event event)
Schedules an event 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:
event - the event to schedule
Returns:
true if the event was scheduled successfully, false if this scheduler is not available to process events

run

public void run()

Specified by:
run in interface Runnable


Copyright © 2011. All Rights Reserved.