org.axonframework.eventhandling
Class SimpleCluster

java.lang.Object
  extended by org.axonframework.eventhandling.AbstractCluster
      extended by org.axonframework.eventhandling.SimpleCluster
All Implemented Interfaces:
Cluster, EventProcessingMonitorSupport

public class SimpleCluster
extends AbstractCluster

A simple Cluster implementation that invokes each of the members of a cluster when an Event is published. When an Event Listener raises an exception, publication of the Event is aborted and the exception is propagated. No guarantees are given about the order of invocation of Event Listeners.

Since:
1.2
Author:
ALlard Buijze

Constructor Summary
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.
 
Method Summary
 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.
 
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

SimpleCluster

public SimpleCluster(String name)
Initializes the cluster with given name.

Parameters:
name - The name of this cluster

SimpleCluster

public 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.

Listeners are invoked with the lowest order first.

Parameters:
name - The name of this cluster
orderResolver - The resolver defining the order in which listeners need to be invoked
Method Detail

doPublish

public void doPublish(List<EventMessage> events,
                      Set<EventListener> eventListeners,
                      MultiplexingEventProcessingMonitor monitor)
Description copied from class: AbstractCluster
Publish the given list of 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.

Specified by:
doPublish in class AbstractCluster
Parameters:
events - The events to publish
eventListeners - The event listeners subscribed at the moment the event arrived
monitor - The monitor to notify after completion.


Copyright © 2010-2016. All Rights Reserved.