org.axonframework.eventhandling
Class ClassNamePatternClusterSelector
java.lang.Object
org.axonframework.eventhandling.AbstractClusterSelector
org.axonframework.eventhandling.ClassNamePatternClusterSelector
- All Implemented Interfaces:
- ClusterSelector
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.
- Since:
- 2.0
- Author:
- Allard Buijze
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
ClassNamePatternClusterSelector
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
.
- Parameters:
pattern
- The pattern to match an Event Listener's class name againstcluster
- The cluster to choose when the pattern matches
doSelectCluster
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
- Parameters:
eventListener
- The listener instance handling the events, possibly a proxylistenerType
- The actual type of the Event Listener
- Returns:
- the cluster to assign the Event Listener to
Copyright © 2010-2016. All Rights Reserved.