public class AsynchronousCluster extends AbstractCluster
SequencingPolicy
,
TransactionManager
Constructor and Description |
---|
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 identifier,
Executor executor,
UnitOfWorkFactory unitOfWorkFactory,
SequencingPolicy<? super EventMessage<?>> sequencingPolicy,
ErrorHandler errorHandler)
Creates an AsynchronousCluster implementation using the given
executor ,
unitOfWorkFactory and sequencingPolicy . |
Modifier and Type | Method and Description |
---|---|
protected EventProcessor |
newProcessingScheduler(EventProcessor.ShutdownCallback shutDownCallback)
Creates a new scheduler instance that schedules tasks on the executor service for the managed EventListener.
|
void |
publish(EventMessage... events)
Publishes the given Events to the members of this cluster.
|
protected void |
schedule(EventMessage<?> task)
Schedules this task for execution when all pre-conditions have been met.
|
getMembers, getMetaData, getName, subscribe, unsubscribe
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 identifier, 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.identifier
- 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 void publish(EventMessage... events)
Cluster
EventListeners
are
discouraged to throw exceptions, it is possible that they are propagated through this method invocation. In that
case, no guarantees can be given about the delivery of Events at all Cluster members.events
- The Events to publish in the clusterprotected void schedule(EventMessage<?> task)
task
- The task to schedule for processing.protected EventProcessor newProcessingScheduler(EventProcessor.ShutdownCallback shutDownCallback)
shutDownCallback
- The callback that needs to be notified when the scheduler stops processing.Copyright © 2010-2013. All Rights Reserved.