Class PropertySequencingPolicy<T,K>
java.lang.Object
org.axonframework.eventhandling.async.PropertySequencingPolicy<T,K>
- Type Parameters:
T- The type of the supported event payloads.K- The type of the extracted property.
- All Implemented Interfaces:
SequencingPolicy<EventMessage>
A
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.- Since:
- 4.5.2
- Author:
- Nils Christian Ehmke
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classBuilder class to instantiate aPropertySequencingPolicy. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedInstantiate aPropertySequencingPolicybased on the fields contained in thePropertySequencingPolicy.Builder. -
Method Summary
Modifier and TypeMethodDescriptionstatic <T,K> PropertySequencingPolicy.Builder <T, K> Instantiate a Builder to be able to create aPropertySequencingPolicy.getSequenceIdentifierFor(EventMessage eventMessage) Returns the sequence identifier for the givenevent.
-
Constructor Details
-
PropertySequencingPolicy
Instantiate aPropertySequencingPolicybased on the fields contained in thePropertySequencingPolicy.Builder.Will assert that the
propertyExtractoris notnulland will throw anAxonConfigurationExceptionif this is the case.- Parameters:
builder- thePropertySequencingPolicy.Builderused to instantiate aPropertySequencingPolicyinstance
-
-
Method Details
-
getSequenceIdentifierFor
Description copied from interface:SequencingPolicyReturns the sequence identifier for the givenevent. When two events have the same identifier (as defined by their equals method), they will be executed sequentially. Anullvalue indicates that there are no sequencing requirements for the handling of this event.- Specified by:
getSequenceIdentifierForin interfaceSequencingPolicy<T>- Parameters:
eventMessage- the event for which to get the sequencing identifier- Returns:
- a sequence identifier for the given event
-
builder
public static <T,K> PropertySequencingPolicy.Builder<T,K> builder(Class<T> payloadClass, Class<K> propertyClass) Instantiate a Builder to be able to create aPropertySequencingPolicy.Upon initialization of this builder, the following fields are defaulted:
- The
fallbackSequencingPolicydefaults to an exception raising sequencing policy.
- The
payloadClasswhich defines the supported type of event message payload. - The
propertyExtractorwhich is applied to the payload and extract the sequence identifier. - The
fallbackSequencingPolicywhich defines the behaviour in case of an unsupported event payload.
- Type Parameters:
T- the type of the supported event payloadsK- the type of the extracted property- Parameters:
payloadClass- the class of the supported event payloadspropertyClass- the class of the extracted property- Returns:
- a Builder to be able to create a
PropertySequencingPolicy
- The
-