org.axonframework.eventhandling
Interface Cluster

All Superinterfaces:
EventProcessingMonitorSupport
All Known Implementing Classes:
AbstractCluster, AsynchronousCluster, ReplayingCluster, SimpleCluster

public interface Cluster
extends EventProcessingMonitorSupport

A cluster represents a group of Event Listeners that are treated as a single group by the ClusteringEventBus. This allows attributes and behavior (e.g. transaction management, asynchronous processing, distribution) to be applied over a whole group at once.

Since:
1.2
Author:
Allard Buijze

Method Summary
 Set<EventListener> getMembers()
          Returns a read-only view on the members in the cluster.
 ClusterMetaData getMetaData()
          Returns the MetaData of this Cluster.
 String getName()
          Returns the name of this cluster.
 void publish(EventMessage... events)
          Publishes the given Events to the members of this cluster.
 void subscribe(EventListener eventListener)
          Subscribe the given eventListener to this cluster.
 void unsubscribe(EventListener eventListener)
          Unsubscribes the given eventListener from this cluster.
 
Methods inherited from interface org.axonframework.eventhandling.EventProcessingMonitorSupport
subscribeEventProcessingMonitor, unsubscribeEventProcessingMonitor
 

Method Detail

getName

String getName()
Returns the name of this cluster. This name is used to detect distributed instances of the same cluster. Multiple instances referring to the same logical cluster (on different JVM's) must have the same name.

Returns:
the name of this cluster

publish

void publish(EventMessage... events)
Publishes the given Events to the members of this cluster.

Implementations may do this synchronously or asynchronously. Although 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.

Parameters:
events - The Events to publish in the cluster

subscribe

void subscribe(EventListener eventListener)
Subscribe the given eventListener to this cluster. If the listener is already subscribed, nothing happens.

While the Event Listeners is subscribed, it will receive all messages published to the cluster.

Parameters:
eventListener - the Event Listener instance to subscribe

unsubscribe

void unsubscribe(EventListener eventListener)
Unsubscribes the given eventListener from this cluster. If the listener is already unsubscribed, or was never subscribed, nothing happens.

Parameters:
eventListener - the Event Listener instance to unsubscribe

getMembers

Set<EventListener> getMembers()
Returns a read-only view on the members in the cluster. This view may be updated by the Cluster when members subscribe or unsubscribe. Cluster implementations may also return the view representing the state at the moment this method is invoked.

Returns:
a view of the members of this cluster

getMetaData

ClusterMetaData getMetaData()
Returns the MetaData of this Cluster.

Returns:
the MetaData of this Cluster


Copyright © 2010-2016. All Rights Reserved.