Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
 /*
  * Copyright (c) 2010-2011. Axon Framework
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at
  *
  *     http://www.apache.org/licenses/LICENSE-2.0
  *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package org.axonframework.eventhandling;
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.

Author(s):
Allard Buijze
Since:
1.2
public interface Cluster {

    
Publishes the given Event 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:
event The Event to publish in the cluster
    void publish(Event event);

    
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
    void subscribe(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
    void unsubscribe(EventListener eventListener);

    
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
    Set<EventListenergetMembers();

    
Returns the MetaData of this Cluster.

Returns:
the MetaData of this Cluster
New to GrepCode? Check out our FAQ X