Class MetadataRoutingStrategy
java.lang.Object
org.axonframework.messaging.commandhandling.MetadataRoutingStrategy
- All Implemented Interfaces:
RoutingStrategy
A
RoutingStrategy implementation that uses the value in the Metadata of a
CommandMessage assigned to a given key.
The value's toString() is used to convert the Metadata value to a String.
- Since:
- 2.0.0
- Author:
- Allard Buijze
-
Constructor Summary
ConstructorsConstructorDescriptionMetadataRoutingStrategy(String metadataKey) Instantiate aMetadataRoutingStrategybased on the fields contained in the givebuilder. -
Method Summary
Modifier and TypeMethodDescriptiongetRoutingKey(CommandMessage command) Generates a routing key for the givencommand.
-
Constructor Details
-
MetadataRoutingStrategy
Instantiate aMetadataRoutingStrategybased on the fields contained in the givebuilder.Will assert that the
metadataKeyis not an emptyStringornulland will throw anAxonConfigurationExceptionif this is the case.- Parameters:
metadataKey- The key in theMetadatato use for routing.
-
-
Method Details
-
getRoutingKey
Description copied from interface:RoutingStrategyGenerates a routing key for the givencommand.Commands that should be handled by the same segment, should result in the same routing key.
- Specified by:
getRoutingKeyin interfaceRoutingStrategy- Parameters:
command- The command to create a routing key for.- Returns:
- The routing key for the command.
-