Package org.axonframework.modelling.saga
Interface Saga<T>
- All Superinterfaces:
EventMessageHandler,MessageHandler<EventMessage<?>>
- All Known Implementing Classes:
AnnotatedSaga
Interface describing an implementation of a Saga. Sagas are instances that handle events and may possibly produce
new commands or have other side effects. Typically, Sagas are used to manage long running business transactions.
Multiple instances of a single type of Saga may exist. In that case, each Saga will be managing a different
transaction. Sagas need to be associated with concepts in order to receive specific events. These associations are
managed through AssociationValues. For example, to associate a saga with an Order with ID 1234, this saga needs an
association value with key
"orderId" and value "1234".- Since:
- 0.7
- Author:
- Allard Buijze
-
Method Summary
Modifier and TypeMethodDescriptionvoidExecute the giveninvocationagainst the root object of this Saga instance.Returns a view on the Association Values for this saga instance.Returns the unique identifier of this saga.<R> RExecute the giveninvocationagainst the root object of this Saga instance.booleanisActive()Indicates whether or not this saga is active.default voidPerforms any activities that are required to reset the state managed by handlers assigned to this handler.default voidprepareReset(Object resetContext) Performs any activities that are required to reset the state managed by handlers assigned to this handler.default booleanIndicates whether the handlers managed by this invoker support a reset.Methods inherited from interface org.axonframework.eventhandling.EventMessageHandler
handleMethods inherited from interface org.axonframework.messaging.MessageHandler
canHandle, canHandleType, getTargetType
-
Method Details
-
getSagaIdentifier
String getSagaIdentifier()Returns the unique identifier of this saga.- Returns:
- the unique identifier of this saga
-
getAssociationValues
AssociationValues getAssociationValues()Returns a view on the Association Values for this saga instance. The returned instance is mutable.- Returns:
- a view on the Association Values for this saga instance
-
invoke
Execute the giveninvocationagainst the root object of this Saga instance.- Type Parameters:
R- The type of return value expected- Parameters:
invocation- the function to invoke. The root object of the Saga is input to the function, the result is the result of the execution.- Returns:
- The result of the invocation on the Saga.
-
execute
Execute the giveninvocationagainst the root object of this Saga instance.- Parameters:
invocation- the function to invoke. The root object of the Saga is input to the function.
-
isActive
boolean isActive()Indicates whether or not this saga is active. A Saga is active when its life cycle has not been ended.- Returns:
trueif this saga is active,falseotherwise.
-
supportsReset
default boolean supportsReset()Description copied from interface:EventMessageHandlerIndicates whether the handlers managed by this invoker support a reset.- Specified by:
supportsResetin interfaceEventMessageHandler- Returns:
trueif a reset is supported, otherwisefalse
-
prepareReset
default void prepareReset()Description copied from interface:EventMessageHandlerPerforms any activities that are required to reset the state managed by handlers assigned to this handler.- Specified by:
prepareResetin interfaceEventMessageHandler
-
prepareReset
Description copied from interface:EventMessageHandlerPerforms any activities that are required to reset the state managed by handlers assigned to this handler.- Specified by:
prepareResetin interfaceEventMessageHandler- Parameters:
resetContext- aRused to support the reset operation
-