public abstract class AbstractSagaManager<T> extends Object implements org.axonframework.eventhandling.EventHandlerInvoker, org.axonframework.messaging.ScopeAware
| Modifier and Type | Class and Description |
|---|---|
static class |
AbstractSagaManager.Builder<T>
Abstract Builder class to instantiate
AbstractSagaManager implementations. |
| Modifier | Constructor and Description |
|---|---|
protected |
AbstractSagaManager(AbstractSagaManager.Builder<T> builder)
Instantiate a
AbstractSagaManager based on the fields contained in the AbstractSagaManager.Builder. |
| Modifier and Type | Method and Description |
|---|---|
boolean |
canResolve(org.axonframework.messaging.ScopeDescriptor scopeDescription) |
protected String |
createSagaIdentifier(org.axonframework.eventhandling.Segment segment)
Creates a Saga identifier that will cause a Saga instance to be considered part of the given
segment. |
protected abstract Set<AssociationValue> |
extractAssociationValues(org.axonframework.eventhandling.EventMessage<?> event)
Extracts the AssociationValues from the given
event as relevant for a Saga of given
sagaType. |
protected abstract SagaInitializationPolicy |
getSagaCreationPolicy(org.axonframework.eventhandling.EventMessage<?> event)
Returns the Saga Initialization Policy for a Saga of the given
sagaType and event. |
Class<T> |
getSagaType()
Returns the class of Saga managed by this SagaManager
|
void |
handle(org.axonframework.eventhandling.EventMessage<?> event,
org.axonframework.eventhandling.Segment segment) |
protected boolean |
matchesSegment(org.axonframework.eventhandling.Segment segment,
String sagaId)
Checks whether the given
sagaId matches with the given segment. |
void |
performReset() |
void |
performReset(Object resetContext) |
void |
send(org.axonframework.messaging.Message<?> message,
org.axonframework.messaging.ScopeDescriptor scopeDescription) |
boolean |
supportsReset() |
protected AbstractSagaManager(AbstractSagaManager.Builder<T> builder)
AbstractSagaManager based on the fields contained in the AbstractSagaManager.Builder.
Will assert that the sagaType, sagaFactory, SagaRepository,
SagaManagerSpanFactory and ListenerInvocationErrorHandler are not null, and will throw an
AxonConfigurationException if any of them is null.
builder - the AbstractSagaManager.Builder used to instantiate a AbstractSagaManager instancepublic void handle(@Nonnull org.axonframework.eventhandling.EventMessage<?> event, @Nonnull org.axonframework.eventhandling.Segment segment) throws Exception
handle in interface org.axonframework.eventhandling.EventHandlerInvokerExceptionprotected String createSagaIdentifier(org.axonframework.eventhandling.Segment segment)
segment.segment - The segment the identifier must match withIdentifierFactory, until
one is returned that matches the given segment. See matchesSegment(Segment, String).protected boolean matchesSegment(org.axonframework.eventhandling.Segment segment,
String sagaId)
sagaId matches with the given segment.
For any complete set of segments, exactly one segment matches with any value.
segment - The segment to validate the identifier forsagaId - The identifier to testtrue if the identifier matches the segment, otherwise falseSegment.matches(Object) to match against the Saga identifierprotected abstract SagaInitializationPolicy getSagaCreationPolicy(org.axonframework.eventhandling.EventMessage<?> event)
sagaType and event. This
policy provides the conditions to create new Saga instance, as well as the initial association of that saga.event - The Event that is being dispatched to Saga instancesprotected abstract Set<AssociationValue> extractAssociationValues(org.axonframework.eventhandling.EventMessage<?> event)
event as relevant for a Saga of given
sagaType. A single event may be associated with multiple values.event - The event containing the association informationpublic Class<T> getSagaType()
public boolean supportsReset()
supportsReset in interface org.axonframework.eventhandling.EventHandlerInvokerpublic void performReset()
performReset in interface org.axonframework.eventhandling.EventHandlerInvokerpublic void performReset(Object resetContext)
performReset in interface org.axonframework.eventhandling.EventHandlerInvokerpublic void send(org.axonframework.messaging.Message<?> message,
org.axonframework.messaging.ScopeDescriptor scopeDescription)
throws Exception
send in interface org.axonframework.messaging.ScopeAwareExceptionpublic boolean canResolve(org.axonframework.messaging.ScopeDescriptor scopeDescription)
canResolve in interface org.axonframework.messaging.ScopeAwareCopyright © 2010–2024. All rights reserved.