T
- The type of the supported event payloads.K
- The type of the extracted property.public class PropertySequencingPolicy<T,K> extends Object implements SequencingPolicy<EventMessage>
SequencingPolicy
implementation that extracts the sequence identifier from the event message payload based
on a given property or property extractor. If the event message payload is not of a supported type, a fallback
sequencing policy is used. By default the fallback sequencing policy raises an exception.Modifier and Type | Class and Description |
---|---|
static class |
PropertySequencingPolicy.Builder<T,K>
Builder class to instantiate a
PropertySequencingPolicy . |
Modifier | Constructor and Description |
---|---|
protected |
PropertySequencingPolicy(PropertySequencingPolicy.Builder builder)
Instantiate a
PropertySequencingPolicy based on the fields contained in the PropertySequencingPolicy.Builder . |
Modifier and Type | Method and Description |
---|---|
static <T,K> PropertySequencingPolicy.Builder<T,K> |
builder(Class<T> payloadClass,
Class<K> propertyClass)
Instantiate a Builder to be able to create a
PropertySequencingPolicy . |
Object |
getSequenceIdentifierFor(EventMessage eventMessage)
Returns the sequence identifier for the given
event . |
protected PropertySequencingPolicy(PropertySequencingPolicy.Builder builder)
PropertySequencingPolicy
based on the fields contained in the PropertySequencingPolicy.Builder
.
Will assert that the propertyExtractor
is not null
and will throw an AxonConfigurationException
if this is the case.
builder
- the PropertySequencingPolicy.Builder
used to instantiate a PropertySequencingPolicy
instancepublic Object getSequenceIdentifierFor(@Nonnull EventMessage eventMessage)
SequencingPolicy
event
. When two events have the same identifier (as defined
by their equals method), they will be executed sequentially. A null
value indicates that there are no
sequencing requirements for the handling of this event.getSequenceIdentifierFor
in interface SequencingPolicy<EventMessage>
eventMessage
- the event for which to get the sequencing identifierpublic static <T,K> PropertySequencingPolicy.Builder<T,K> builder(Class<T> payloadClass, Class<K> propertyClass)
PropertySequencingPolicy
.
Upon initialization of this builder, the following fields are defaulted:
fallbackSequencingPolicy
defaults to an exception raising sequencing policy.
payloadClass
which defines the supported type of event message payload.propertyExtractor
which is applied to the payload and extract the sequence identifier.fallbackSequencingPolicy
which defines the behaviour in case of an unsupported event payload.T
- the type of the supported event payloadsK
- the type of the extracted propertypayloadClass
- the class of the supported event payloadspropertyClass
- the class of the extracted propertyPropertySequencingPolicy
Copyright © 2010–2024. All rights reserved.