public class ClassNamePrefixClusterSelector extends AbstractClusterSelector
org.axonframework -> cluster1 com. -> cluster2 com.somecompany -> cluster3A class named
com.somecompany.SomeListener will map to cluster3 as it is mapped to a more
specific prefix. This implementation uses String.startsWith(String) to evaluate a match.
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.| Constructor and Description |
|---|
ClassNamePrefixClusterSelector(Map<String,Cluster> mappings)
Initializes the ClassNamePrefixClusterSelector using the given
mappings. |
ClassNamePrefixClusterSelector(Map<String,Cluster> mappings,
Cluster defaultCluster)
Initializes the ClassNamePrefixClusterSelector using the given
mappings. |
ClassNamePrefixClusterSelector(String prefix,
Cluster cluster)
Initializes the ClassNamePrefixClusterSelector where classes starting with the given
prefix will be
mapped to the given cluster. |
| Modifier and Type | Method and Description |
|---|---|
Cluster |
doSelectCluster(EventListener eventListener,
Class<?> listenerType)
Select a cluster for the given
eventListener, which has the actual class listenerType. |
selectClusterpublic ClassNamePrefixClusterSelector(String prefix, Cluster cluster)
prefix will be
mapped to the given cluster.
This method is identical to ClassNamePrefixClusterSelector(java.util.Map) with only a single mapping.prefix - The prefix of the fully qualified classname to match againstcluster - The cluster to choose if a match is foundpublic ClassNamePrefixClusterSelector(Map<String,Cluster> mappings)
mappings. If a name does not have a
prefix defined, the Cluster Selector returns null.mappings - the mappings defining a cluster for each Class Name prefixpublic ClassNamePrefixClusterSelector(Map<String,Cluster> mappings, Cluster defaultCluster)
mappings. If a name does not have a
prefix defined, the Cluster Selector returns the given defaultCluster.mappings - the mappings defining a cluster for each Class Name prefixdefaultCluster - The cluster to use when no mapping is presentpublic Cluster doSelectCluster(EventListener eventListener, Class<?> listenerType)
AbstractClusterSelectoreventListener, 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.doSelectCluster in class AbstractClusterSelectoreventListener - The listener instance handling the events, possibly a proxylistenerType - The actual type of the Event ListenerCopyright © 2010-2014. All Rights Reserved.