|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.axonframework.eventhandling.AbstractCluster org.axonframework.eventhandling.async.AsynchronousCluster
public class AsynchronousCluster
Cluster implementation that publishes events to the subscribed Event Listeners asynchronously from the publishing thread. This implementation can be configured to retry event when processing fails. Furthermore, a SequencingPolicy will tell the cluster which Events need to be processed sequentially, and which may be processed in parallel from others.
SequencingPolicy
,
TransactionManager
Constructor Summary | |
---|---|
AsynchronousCluster(String identifier,
Executor executor,
SequencingPolicy<? super EventMessage<?>> sequencingPolicy)
Creates an AsynchronousCluster implementation using the given executor and
sequencingPolicy . |
|
AsynchronousCluster(String identifier,
Executor executor,
TransactionManager transactionManager,
SequencingPolicy<? super EventMessage<?>> sequencingPolicy)
Creates an AsynchronousCluster implementation using the given executor ,
transactionManager and sequencingPolicy . |
|
AsynchronousCluster(String identifier,
Executor executor,
TransactionManager transactionManager,
SequencingPolicy<? super EventMessage<?>> sequencingPolicy,
ErrorHandler errorHandler)
Creates an AsynchronousCluster implementation using the given executor ,
transactionManager and sequencingPolicy . |
|
AsynchronousCluster(String name,
Executor executor,
UnitOfWorkFactory unitOfWorkFactory,
SequencingPolicy<? super EventMessage<?>> sequencingPolicy,
ErrorHandler errorHandler)
Creates an AsynchronousCluster implementation using the given executor ,
unitOfWorkFactory and sequencingPolicy . |
|
AsynchronousCluster(String name,
Executor executor,
UnitOfWorkFactory unitOfWorkFactory,
SequencingPolicy<? super EventMessage<?>> sequencingPolicy,
ErrorHandler errorHandler,
OrderResolver orderResolver)
Creates an AsynchronousCluster implementation using the given executor ,
unitOfWorkFactory and sequencingPolicy . |
Method Summary | |
---|---|
protected void |
doPublish(List<EventMessage> events,
Set<EventListener> eventListeners,
MultiplexingEventProcessingMonitor eventProcessingMonitor)
Publish the given list of events to the given set of eventListeners , and notify the
given eventProcessingMonitor after completion. |
protected EventProcessor |
newProcessingScheduler(EventProcessor.ShutdownCallback shutDownCallback,
Set<EventListener> eventListeners,
MultiplexingEventProcessingMonitor eventProcessingMonitor)
Creates a new scheduler instance that schedules tasks on the executor service for the managed EventListener. |
protected void |
schedule(EventMessage<?> task,
MultiplexingEventProcessingMonitor eventProcessingMonitor)
Schedules this task for execution when all pre-conditions have been met. |
Methods inherited from class org.axonframework.eventhandling.AbstractCluster |
---|
getMembers, getMetaData, getName, publish, subscribe, subscribeEventProcessingMonitor, unsubscribe, unsubscribeEventProcessingMonitor |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public AsynchronousCluster(String identifier, Executor executor, TransactionManager transactionManager, SequencingPolicy<? super EventMessage<?>> sequencingPolicy)
executor
,
transactionManager
and sequencingPolicy
. Failed events are retried if they are not
explicitly non-transient with an interval of 2 seconds.
identifier
- The unique identifier of this clusterexecutor
- The executor to process event batches withtransactionManager
- The TransactionManager that manages transactions around event processing batchessequencingPolicy
- The policy indicating which events must be processed sequentially, and which may be
executed in parallel.public AsynchronousCluster(String identifier, Executor executor, SequencingPolicy<? super EventMessage<?>> sequencingPolicy)
executor
and
sequencingPolicy
. Each handler will receive each event once, ignoring exceptions they may throw.
The Unit of Work in which Events are handled is not backed by any Transaction Manager.
identifier
- The unique identifier of this clusterexecutor
- The executor to process event batches withsequencingPolicy
- The policy indicating which events must be processed sequentially, and which may be
executed in parallel.public AsynchronousCluster(String identifier, Executor executor, TransactionManager transactionManager, SequencingPolicy<? super EventMessage<?>> sequencingPolicy, ErrorHandler errorHandler)
executor
,
transactionManager
and sequencingPolicy
. Failures are processed by the given
errorHandler
.
The Cluster is initialized with a DefaultUnitOfWorkFactory
, using the given
transactionManager
to manage the backing transactions.
identifier
- The unique identifier of this clusterexecutor
- The executor to process event batches withtransactionManager
- The TransactionManager that manages transactions around event processing batchessequencingPolicy
- The policy indicating which events must be processed sequentially, and which may be
executed in parallel.errorHandler
- The handler that handles error during event processingpublic AsynchronousCluster(String name, Executor executor, UnitOfWorkFactory unitOfWorkFactory, SequencingPolicy<? super EventMessage<?>> sequencingPolicy, ErrorHandler errorHandler)
executor
,
unitOfWorkFactory
and sequencingPolicy
. Failures are processed by the given
errorHandler
.
If transactions are required, the given unitOfWorkFactory
should be configured to create
Transaction backed Unit of Work instances.
name
- The unique identifier of this clusterexecutor
- The executor to process event batches withunitOfWorkFactory
- The Unit of Work Factory Manager that manages Units of Work around event processingsequencingPolicy
- The policy indicating which events must be processed sequentially, and which may be
executed in parallel.errorHandler
- The handler that handles error during event processingpublic AsynchronousCluster(String name, Executor executor, UnitOfWorkFactory unitOfWorkFactory, SequencingPolicy<? super EventMessage<?>> sequencingPolicy, ErrorHandler errorHandler, OrderResolver orderResolver)
executor
,
unitOfWorkFactory
and sequencingPolicy
. Failures are processed by the given
errorHandler
. Event Listeners are invoked in the order provided by the orderResolver
.
If transactions are required, the given unitOfWorkFactory
should be configured to create
Transaction backed Unit of Work instances.
Event Listeners with the lowest order are invoked first.
name
- The unique identifier of this clusterexecutor
- The executor to process event batches withunitOfWorkFactory
- The Unit of Work Factory Manager that manages Units of Work around event processingsequencingPolicy
- The policy indicating which events must be processed sequentially, and which may be
executed in parallel.errorHandler
- The handler that handles error during event processingorderResolver
- The resolver providing the expected order of the listenersMethod Detail |
---|
protected void doPublish(List<EventMessage> events, Set<EventListener> eventListeners, MultiplexingEventProcessingMonitor eventProcessingMonitor)
AbstractCluster
events
to the given set of eventListeners
, and notify the
given eventProcessingMonitor
after completion. The given set of eventListeners
is a
live view on the memberships of the cluster. Any subscription changes are immediately visible in this set.
Iterators created on the set iterate over an immutable view reflecting the state at the moment the iterator was
created.
When this method is invoked as part of a Unit of Work (see
CurrentUnitOfWork.isStarted()
), the monitor invocation should be postponed
until the Unit of Work is committed or rolled back, to ensure any transactions are properly propagated when the
monitor is invoked.
It is the implementation's responsibility to ensure that –eventually– the each of the given
events
is provided to the eventProcessingMonitor
, either to the EventProcessingMonitor.onEventProcessingCompleted(java.util.List)
or the EventProcessingMonitor.onEventProcessingFailed(java.util.List, Throwable)
method.
doPublish
in class AbstractCluster
events
- The events to publisheventListeners
- The event listeners subscribed at the moment the event arrivedeventProcessingMonitor
- The monitor to notify after completion.protected void schedule(EventMessage<?> task, MultiplexingEventProcessingMonitor eventProcessingMonitor)
task
- The task to schedule for processing.eventProcessingMonitor
- The monitor to invoke after completionprotected EventProcessor newProcessingScheduler(EventProcessor.ShutdownCallback shutDownCallback, Set<EventListener> eventListeners, MultiplexingEventProcessingMonitor eventProcessingMonitor)
shutDownCallback
- The callback that needs to be notified when the scheduler stops processing.eventListeners
- The listeners to process the event witheventProcessingMonitor
- @return a new scheduler instance
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |