public enum UnresolvedRoutingKeyPolicy extends Enum<UnresolvedRoutingKeyPolicy> implements RoutingStrategy
RoutingStrategy
implementations. Could for example be used as fallback solutions when another
RoutingStrategy
is unable to resolve the routing key.Enum Constant and Description |
---|
ERROR
A
RoutingStrategy which always throws a CommandDispatchException regardless of the CommandMessage received. |
RANDOM_KEY
Policy that indicates a random key is to be returned when no Routing Key can be found for a Command Message.
|
STATIC_KEY
Policy that indicates a fixed key ("unresolved") should be returned when no Routing Key can be found for a
Command Message.
|
Modifier and Type | Method and Description |
---|---|
String |
getRoutingKey(CommandMessage<?> command)
Generates a routing key for the given
command . |
static UnresolvedRoutingKeyPolicy |
valueOf(String name)
Returns the enum constant of this type with the specified name.
|
static UnresolvedRoutingKeyPolicy[] |
values()
Returns an array containing the constants of this enum type, in
the order they are declared.
|
public static final UnresolvedRoutingKeyPolicy ERROR
RoutingStrategy
which always throws a CommandDispatchException
regardless of the CommandMessage
received. 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 from AxonNonTransientException
to indicate that retries do not
have a chance to succeed.
RetryScheduler
public static final UnresolvedRoutingKeyPolicy RANDOM_KEY
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.
public static final UnresolvedRoutingKeyPolicy STATIC_KEY
public static UnresolvedRoutingKeyPolicy[] values()
for (UnresolvedRoutingKeyPolicy c : UnresolvedRoutingKeyPolicy.values()) System.out.println(c);
public static UnresolvedRoutingKeyPolicy valueOf(String name)
name
- the name of the enum constant to be returned.IllegalArgumentException
- if this enum type has no constant with the specified nameNullPointerException
- if the argument is nullpublic String getRoutingKey(@Nonnull CommandMessage<?> command)
RoutingStrategy
command
. Commands that should be handled by the same segment,
should result in the same routing key.getRoutingKey
in interface RoutingStrategy
command
- the command to create a routing key forCopyright © 2010–2023. All rights reserved.