public class MetaDataRoutingStrategy extends AbstractRoutingStrategy
MetaData
of a CommandMessage
assigned to a given key. The value's toString()
is used to convert the MetaData
value
to a String.Modifier and Type | Class and Description |
---|---|
static class |
MetaDataRoutingStrategy.Builder
Builder class to instantiate a
AnnotationRoutingStrategy . |
Modifier | Constructor and Description |
---|---|
protected |
MetaDataRoutingStrategy(MetaDataRoutingStrategy.Builder builder)
Instantiate a
MetaDataRoutingStrategy based on the fields contained in the give builder . |
|
MetaDataRoutingStrategy(String metaDataKey)
Deprecated.
in favor of the
builder() |
|
MetaDataRoutingStrategy(String metaDataKey,
UnresolvedRoutingKeyPolicy unresolvedRoutingKeyPolicy)
Deprecated.
in favor of the
builder() |
Modifier and Type | Method and Description |
---|---|
static MetaDataRoutingStrategy.Builder |
builder()
Instantiate a Builder to be able to create a
MetaDataRoutingStrategy . |
protected String |
doResolveRoutingKey(CommandMessage<?> command)
Resolve the Routing Key for the given
command . |
getRoutingKey
protected MetaDataRoutingStrategy(MetaDataRoutingStrategy.Builder builder)
MetaDataRoutingStrategy
based on the fields contained in the give builder
.
Will assert that the metaDataKey
is not an empty String
or null
and will throw an AxonConfigurationException
if this is the case.
builder
- the MetaDataRoutingStrategy.Builder
used to instantiate a MetaDataRoutingStrategy
instance@Deprecated public MetaDataRoutingStrategy(String metaDataKey)
builder()
metaDataKey
is used to get the Meta Data value.
An error is raised when the MetaData key cannot be found.metaDataKey
- the key on which the value is retrieved from the MetaData@Deprecated public MetaDataRoutingStrategy(String metaDataKey, UnresolvedRoutingKeyPolicy unresolvedRoutingKeyPolicy)
builder()
metaDataKey
is used to get the Meta Data value.
The given unresolvedRoutingKeyPolicy
prescribes what to do when the Meta Data properties cannot be
found.metaDataKey
- the key on which the value is retrieved from the MetaDataunresolvedRoutingKeyPolicy
- the policy prescribing behavior when the routing key cannot be resolvedpublic static MetaDataRoutingStrategy.Builder builder()
MetaDataRoutingStrategy
.
The fallbackRoutingStrategy
to UnresolvedRoutingKeyPolicy.RANDOM_KEY
. The metaDataKey
is
a hard requirements and as such should be provided.
MetaDataRoutingStrategy
protected String doResolveRoutingKey(@Nonnull CommandMessage<?> command)
AbstractRoutingStrategy
command
.doResolveRoutingKey
in class AbstractRoutingStrategy
command
- the command to resolve the routing key fornull
if unresolvedCopyright © 2010–2024. All rights reserved.