public enum UnresolvedRoutingKeyPolicy extends Enum<UnresolvedRoutingKeyPolicy> implements RoutingStrategy
RoutingStrategyimplementations. Could for example be used as fallback solutions when another
RoutingStrategyis unable to resolve the routing key.
|Enum Constant and Description|
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.
|Modifier and Type||Method and Description|
Generates a routing key for the given
Returns the enum constant of this type with the specified name.
Returns an array containing the constants of this enum type, in the order they are declared.
clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
public static final UnresolvedRoutingKeyPolicy ERROR
RoutingStrategywhich always throws a
CommandDispatchExceptionregardless of the
CommandMessagereceived. 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.
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)
public String getRoutingKey(@Nonnull CommandMessage<?> command)
command. Commands that should be handled by the same segment, should result in the same routing key.
Copyright © 2010–2023. All rights reserved.