Class AbstractRoutingStrategy
java.lang.Object
org.axonframework.commandhandling.distributed.AbstractRoutingStrategy
- All Implemented Interfaces:
RoutingStrategy
- Direct Known Subclasses:
AnnotationRoutingStrategy,MetaDataRoutingStrategy
Abstract implementation of the
RoutingStrategy interface that includes a fallback RoutingStrategy
which prescribes what happens when routing cannot be resolved by this implementation.- Since:
- 2.0
- Author:
- Allard Buijze
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedAbstractRoutingStrategy(RoutingStrategy fallbackRoutingStrategy) Initializes the strategy using givenRoutingStrategyprescribing the fallback approach when this implementation cannot resolve a routing key.AbstractRoutingStrategy(UnresolvedRoutingKeyPolicy fallbackRoutingStrategy) Deprecated. -
Method Summary
Modifier and TypeMethodDescriptionprotected abstract StringdoResolveRoutingKey(CommandMessage<?> command) Resolve the Routing Key for the givencommand.getRoutingKey(CommandMessage<?> command) Generates a routing key for the givencommand.
-
Constructor Details
-
AbstractRoutingStrategy
@Deprecated public AbstractRoutingStrategy(@Nonnull UnresolvedRoutingKeyPolicy fallbackRoutingStrategy) Deprecated.in favor ofAbstractRoutingStrategy(RoutingStrategy)Initializes the strategy using givenUnresolvedRoutingKeyPolicyprescribing the fallback approach when this implementation cannot resolve a routing key.- Parameters:
fallbackRoutingStrategy- the fallback routing to use whenever thisRoutingStrategydoesn't succeed
-
AbstractRoutingStrategy
Initializes the strategy using givenRoutingStrategyprescribing the fallback approach when this implementation cannot resolve a routing key.- Parameters:
fallbackRoutingStrategy- the fallback routing to use whenever thisRoutingStrategydoesn't succeed
-
-
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
-
doResolveRoutingKey
Resolve the Routing Key for the givencommand.- Parameters:
command- the command to resolve the routing key for- Returns:
- the String representing the Routing Key, or
nullif unresolved
-
AbstractRoutingStrategy(RoutingStrategy)