Enum Class UnresolvedRoutingKeyPolicy
java.lang.Object
java.lang.Enum<UnresolvedRoutingKeyPolicy>
org.axonframework.messaging.commandhandling.UnresolvedRoutingKeyPolicy
- All Implemented Interfaces:
Serializable,Comparable<UnresolvedRoutingKeyPolicy>,Constable,RoutingStrategy
public enum UnresolvedRoutingKeyPolicy
extends Enum<UnresolvedRoutingKeyPolicy>
implements RoutingStrategy
Set of simple
RoutingStrategy implementations.
Could for example be used as fallback solutions when another RoutingStrategy is unable to resolve the routing
key.
- Since:
- 2.0.0
- Author:
- Allard Buijze
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>> -
Enum Constant Summary
Enum ConstantsEnum ConstantDescriptionARoutingStrategywhich always throws aCommandDispatchExceptionregardless of theCommandMessagereceived.Policy that indicates a random key is to be returned when no Routing Key can be found for a Command Message.Policy that indicates a fixed key ("unresolved") should be returned when no Routing Key can be found for a Command Message. -
Method Summary
Modifier and TypeMethodDescriptiongetRoutingKey(CommandMessage command) Generates a routing key for the givencommand.static UnresolvedRoutingKeyPolicyReturns the enum constant of this class with the specified name.static UnresolvedRoutingKeyPolicy[]values()Returns an array containing the constants of this enum class, in the order they are declared.
-
Enum Constant Details
-
ERROR
ARoutingStrategywhich always throws aCommandDispatchExceptionregardless of theCommandMessagereceived. Only feasible as a fallback solution which should straight out fail if the intended policy is unable to resolve a routing key.Note that when the routing key is based on static content in the
CommandMessage, the exception raised should extend fromAxonNonTransientExceptionto indicate that retries do not have a chance to succeed.- See Also:
-
RANDOM_KEY
Policy that indicates a random key is to be returned when no Routing Key can be found for a Command Message. This effectively means the Command Message is routed to a random segment.Although not required to be fully random, implementations are required to return a different key for each incoming command. Multiple invocations for the same command message may return the same value, but are not required to do so.
-
STATIC_KEY
Policy that indicates a fixed key ("unresolved") should be returned when no Routing Key can be found for a Command Message. This effectively means all Command Messages with unresolved routing keys are routed to a the same segment. The load of that segment may therefore not match the load factor.
-
-
Method Details
-
values
Returns an array containing the constants of this enum class, in the order they are declared.- Returns:
- an array containing the constants of this enum class, in the order they are declared
-
valueOf
Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)- Parameters:
name- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException- if this enum class has no constant with the specified nameNullPointerException- if the argument is null
-
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.
-