Package org.axonframework.modelling.saga
Interface Saga<T>
- All Superinterfaces:
org.axonframework.eventhandling.EventMessageHandler,org.axonframework.messaging.MessageHandler<org.axonframework.eventhandling.EventMessage<?>>
- All Known Implementing Classes:
AnnotatedSaga
public interface Saga<T>
extends org.axonframework.eventhandling.EventMessageHandler
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 voiddefault voidprepareReset(Object resetContext) default booleanMethods 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()- Specified by:
supportsResetin interfaceorg.axonframework.eventhandling.EventMessageHandler
-
prepareReset
default void prepareReset()- Specified by:
prepareResetin interfaceorg.axonframework.eventhandling.EventMessageHandler
-
prepareReset
- Specified by:
prepareResetin interfaceorg.axonframework.eventhandling.EventMessageHandler
-