|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.axonframework.commandhandling.distributed.AbstractRoutingStrategy org.axonframework.commandhandling.distributed.AnnotationRoutingStrategy
public class AnnotationRoutingStrategy
RoutingStrategy that expects an TargetAggregateIdentifier
annotation on the command message's payload. Commands are routed based on the identifier of the aggregate that they
target. This approach ensures that commands to be processed by the same aggregate are dispatched to the same node in
a DistributedCommandBus. See AnnotationCommandTargetResolver
for more details.
Object.toString()
method. An
inconsistent toString() method may result in different members using different routing keys for the same identifier.
AnnotationCommandTargetResolver
,
DistributedCommandBus
Constructor Summary | |
---|---|
AnnotationRoutingStrategy()
Initializes a Routing Strategy that fails when an incoming command does not define an AggregateIdentifier to base the routing key on. |
|
AnnotationRoutingStrategy(Class<? extends Annotation> annotationType)
Initializes a Routing Strategy that uses the given annotation to resolve the targeted identifier. |
|
AnnotationRoutingStrategy(Class<? extends Annotation> annotationType,
UnresolvedRoutingKeyPolicy unresolvedRoutingKeyPolicy)
Initializes a Routing Strategy that uses the given annotation to resolve the targeted identifier and the given unresolvedRoutingKeyPolicy when an incoming command does not define an AggregateIdentifier to base
the routing key on. |
|
AnnotationRoutingStrategy(UnresolvedRoutingKeyPolicy unresolvedRoutingKeyPolicy)
Initializes a Routing Strategy that uses the given unresolvedRoutingKeyPolicy when an incoming
command does not define an AggregateIdentifier to base the routing key on. |
Method Summary | |
---|---|
protected String |
doResolveRoutingKey(CommandMessage<?> command)
Resolve the Routing Key for the given command . |
Methods inherited from class org.axonframework.commandhandling.distributed.AbstractRoutingStrategy |
---|
getRoutingKey |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public AnnotationRoutingStrategy()
public AnnotationRoutingStrategy(Class<? extends Annotation> annotationType)
annotationType
- The type of annotation marking the field or method providing the identifier of the
targeted aggregate.public AnnotationRoutingStrategy(UnresolvedRoutingKeyPolicy unresolvedRoutingKeyPolicy)
unresolvedRoutingKeyPolicy
when an incoming
command does not define an AggregateIdentifier to base the routing key on.
unresolvedRoutingKeyPolicy
- The policy indication what should be done when a Command does not contain
information about the routing key to use.public AnnotationRoutingStrategy(Class<? extends Annotation> annotationType, UnresolvedRoutingKeyPolicy unresolvedRoutingKeyPolicy)
unresolvedRoutingKeyPolicy
when an incoming command does not define an AggregateIdentifier to base
the routing key on.
annotationType
- The type of annotation marking the field or method providing the identifier of
the targeted aggregate.unresolvedRoutingKeyPolicy
- The policy indication what should be done when a Command does not contain
information about the routing key to use.Method Detail |
---|
protected String doResolveRoutingKey(CommandMessage<?> command)
AbstractRoutingStrategy
command
.
doResolveRoutingKey
in class AbstractRoutingStrategy
command
- The command to resolve the routing key for
null
if unresolved.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |