Class AnnotationRoutingStrategy

java.lang.Object
org.axonframework.commandhandling.distributed.AbstractRoutingStrategy
org.axonframework.commandhandling.distributed.AnnotationRoutingStrategy
All Implemented Interfaces:
RoutingStrategy

public class AnnotationRoutingStrategy extends AbstractRoutingStrategy
RoutingStrategy that expects an RoutingKey (meta-)annotation on the command message's payload. Commands are routed based on an identifier annotated with the RoutingKey. This approach ensures that commands with the same identifier, thus dealt with by the same target, are dispatched to the same node in a distributed Command Bus (e.g. AxonServerCommandBus or DistributedCommandBus).

An example would be the TargetAggregateIdentifier annotation, which is meta-annotated with RoutingKey. See the AnnotationCommandTargetResolver for more details on this approach.

This class requires the returned routing keys to implement a proper Object.toString() method. An inconsistent toString() method may result in different members using different routing keys for the same identifier.

Since:
2.0
Author:
Allard Buijze
See Also: