Class ClassNamePatternClusterSelector

  extended by org.axonframework.eventhandling.AbstractClusterSelector
      extended by org.axonframework.eventhandling.ClassNamePatternClusterSelector
All Implemented Interfaces:

public class ClassNamePatternClusterSelector
extends AbstractClusterSelector

ClusterSelector implementation that chooses a Cluster based on whether the Listener's Class Name matches a given Pattern.

The given pattern must match the entire class name, not just part of it.

Note that the name of the class used is the name of the class implementing the EventListener interface. If a listener implements the EventListenerProxy interface, the value of the EventListenerProxy.getTargetType() is used. Annotated Event Listeners will always have the actual annotated class name used.

Allard Buijze

Constructor Summary
ClassNamePatternClusterSelector(Pattern pattern, Cluster cluster)
          Initializes the ClassNamePrefixClusterSelector using the given mappings.
Method Summary
 Cluster doSelectCluster(EventListener eventListener, Class listenerType)
          Select a cluster for the given eventListener, which has the actual class listenerType.
Methods inherited from class org.axonframework.eventhandling.AbstractClusterSelector
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Constructor Detail


public ClassNamePatternClusterSelector(Pattern pattern,
                                       Cluster cluster)
Initializes the ClassNamePrefixClusterSelector using the given mappings. If a name does not have a prefix defined, the Cluster Selector returns the given defaultCluster.

pattern - The pattern to match an Event Listener's class name against
cluster - The cluster to choose when the pattern matches
Method Detail


public Cluster doSelectCluster(EventListener eventListener,
                               Class listenerType)
Description copied from class: AbstractClusterSelector
Select a cluster for the given eventListener, which has the actual class listenerType. Note that the given listenerType does not have to be assignable to EventListener, as it is possible that the eventListener acts as a proxy to an instance of listenerType.

Specified by:
doSelectCluster in class AbstractClusterSelector
eventListener - The listener instance handling the events, possibly a proxy
listenerType - The actual type of the Event Listener
the cluster to assign the Event Listener to

Copyright © 2010-2016. All Rights Reserved.