T
- The type of Saga managed by this instancepublic class AnnotatedSagaManager<T> extends AbstractSagaManager<T>
Modifier and Type | Class and Description |
---|---|
static class |
AnnotatedSagaManager.Builder<T>
Builder class to instantiate a
AnnotatedSagaManager . |
Modifier | Constructor and Description |
---|---|
protected |
AnnotatedSagaManager(AnnotatedSagaManager.Builder<T> builder)
Instantiate a
AnnotatedSagaManager based on the fields contained in the AnnotatedSagaManager.Builder . |
Modifier and Type | Method and Description |
---|---|
static <T> AnnotatedSagaManager.Builder<T> |
builder()
Instantiate a Builder to be able to create a
AnnotatedSagaManager . |
boolean |
canHandle(EventMessage<?> eventMessage,
Segment segment)
Check whether or not this invoker has handlers that can handle the given
eventMessage for a given segment . |
protected Set<AssociationValue> |
extractAssociationValues(EventMessage<?> event)
Extracts the AssociationValues from the given
event as relevant for a Saga of given
sagaType . |
protected SagaInitializationPolicy |
getSagaCreationPolicy(EventMessage<?> event)
Returns the Saga Initialization Policy for a Saga of the given
sagaType and event . |
canResolve, createSagaIdentifier, getSagaType, handle, matchesSegment, performReset, performReset, send, supportsReset
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
canHandleType, segmentReleased
protected AnnotatedSagaManager(AnnotatedSagaManager.Builder<T> builder)
AnnotatedSagaManager
based on the fields contained in the AnnotatedSagaManager.Builder
.
The sagaFactory
is defaulted to a sagaType.newInstance()
call throwing a
SagaInstantiationException
if it fails, the SagaManagerSpanFactory
defaults to a
DefaultSagaManagerSpanFactory
backed by a NoOpSpanFactory
, and the
ListenerInvocationErrorHandler
is defaulted to a LoggingErrorHandler
. The SagaRepository
and sagaType
are hard requirements and as such should be provided.
Will assert that the SagaRepository
, sagaType
, sagaFactory
and
ListenerInvocationErrorHandler
are not null
, and will throw an
AxonConfigurationException
if any of them is null
. Additionally, the
provided Builder's goal is to either build a SagaModel
specifying generic T
as the Saga type to
be stored or derive it based on the given sagaType
. All Sagas managed by this Saga manager must be
instanceOf
this Saga type.
builder
- the AnnotatedSagaManager.Builder
used to instantiate a AnnotatedSagaManager
instancepublic static <T> AnnotatedSagaManager.Builder<T> builder()
AnnotatedSagaManager
.
The sagaFactory
is defaulted to a sagaType.newInstance()
call throwing a
SagaInstantiationException
if it fails, the ListenerInvocationErrorHandler
is defaulted to a
LoggingErrorHandler
and the SagaManagerSpanFactory
is defaulted to a
DefaultSagaManagerSpanFactory
backed by a NoOpSpanFactory
.
This Builder either allows directly setting a SagaModel
of generic type T
, or it will generate
one based of the required sagaType
field of type Class
. Thus, either the SagaModel or the
sagaType
should be provided. All Sagas managed by this instances must be instanceOf
this saga
type. Additionally, the SagaRepository
and sagaType
are hard requirements and as such
should be provided.
T
- a generic specifying the Saga type managed by this AbstractSagaManager
implementationAnnotatedSagaManager
public boolean canHandle(@Nonnull EventMessage<?> eventMessage, @Nonnull Segment segment)
EventHandlerInvoker
eventMessage
for a given segment
.eventMessage
- The message to be processedsegment
- The segment for which the event handler should be invokedtrue
if the invoker has one or more handlers that can handle the given message, false
otherwiseprotected SagaInitializationPolicy getSagaCreationPolicy(EventMessage<?> event)
AbstractSagaManager
sagaType
and event
. This
policy provides the conditions to create new Saga instance, as well as the initial association of that saga.getSagaCreationPolicy
in class AbstractSagaManager<T>
event
- The Event that is being dispatched to Saga instancesprotected Set<AssociationValue> extractAssociationValues(EventMessage<?> event)
AbstractSagaManager
event
as relevant for a Saga of given
sagaType
. A single event may be associated with multiple values.extractAssociationValues
in class AbstractSagaManager<T>
event
- The event containing the association informationCopyright © 2010–2024. All rights reserved.