public class SimpleCluster extends AbstractCluster
Constructor and Description |
---|
SimpleCluster(String name)
Initializes the cluster with given
name . |
SimpleCluster(String name,
OrderResolver orderResolver)
Initializes the cluster with given
name , using given orderResolver to define the
order in which listeners need to be invoked. |
Modifier and Type | Method and Description |
---|---|
void |
doPublish(List<EventMessage> events,
Set<EventListener> eventListeners,
MultiplexingEventProcessingMonitor monitor)
Publish the given list of
events to the given set of eventListeners , and notify the
given eventProcessingMonitor after completion. |
getMembers, getMetaData, getName, publish, subscribe, subscribeEventProcessingMonitor, unsubscribe, unsubscribeEventProcessingMonitor
public SimpleCluster(String name)
name
.name
- The name of this clusterpublic SimpleCluster(String name, OrderResolver orderResolver)
name
, using given orderResolver
to define the
order in which listeners need to be invoked.
Listeners are invoked with the lowest order first.name
- The name of this clusterorderResolver
- The resolver defining the order in which listeners need to be invokedpublic void doPublish(List<EventMessage> events, Set<EventListener> eventListeners, MultiplexingEventProcessingMonitor monitor)
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 arrivedmonitor
- The monitor to notify after completion.Copyright © 2010-2014. All Rights Reserved.