public abstract class SagaLifecycle extends Scope
| Constructor and Description |
|---|
SagaLifecycle() |
| Modifier and Type | Method and Description |
|---|---|
static void |
associateWith(AssociationValue associationValue)
Registers a AssociationValue with the currently active saga.
|
static void |
associateWith(String associationKey,
Number associationValue)
Registers a AssociationValue with the currently active saga.
|
static void |
associateWith(String associationKey,
String associationValue)
Registers a AssociationValue with the currently active saga.
|
ScopeDescriptor |
describeScope()
Provide a description of this
Scope. |
protected abstract void |
doAssociateWith(AssociationValue associationValue)
SagaLifecycle instance method to register the given associationValue. |
protected abstract void |
doEnd()
SagaLifecycle instance method to mark the current saga as ended. |
protected abstract void |
doRemoveAssociation(AssociationValue associationValue)
SagaLifecycle instance method to remove the given associationValue. |
static void |
end()
Marks the saga as ended.
|
protected void |
execute(Runnable task)
SagaLifecycle instance method to execute given task in the context of this SagaLifeCycle. |
protected static SagaLifecycle |
getInstance()
Get the current
SagaLifecycle instance for the current thread. |
protected abstract String |
getSagaIdentifier()
Retrieve a
String denoting the identifier of this Saga. |
static void |
removeAssociationWith(String associationKey,
Number associationValue)
Removes the given association from the currently active Saga.
|
static void |
removeAssociationWith(String associationKey,
String associationValue)
Removes the given association from the currently active Saga.
|
protected abstract String |
type()
Retrieve a
String denoting the type of this Saga. |
describeCurrentScope, endScope, executeWithResult, getCurrentScope, startScopepublic static void associateWith(String associationKey, String associationValue)
associationKey - The key of the association value to associate this saga with.associationValue - The value of the association value to associate this saga with.public static void associateWith(String associationKey, Number associationValue)
associationKey - The key of the association value to associate this saga with.associationValue - The value of the association value to associate this saga with.public static void associateWith(AssociationValue associationValue)
associationValue - The association to associate this saga with.public static void removeAssociationWith(String associationKey, String associationValue)
associationKey - The key of the association value to remove from this saga.associationValue - The value of the association value to remove from this saga.public static void removeAssociationWith(String associationKey, Number associationValue)
associationKey - The key of the association value to remove from this saga.associationValue - The value of the association value to remove from this saga.public static void end()
protected abstract void doEnd()
SagaLifecycle instance method to mark the current saga as ended.protected abstract void doRemoveAssociation(AssociationValue associationValue)
SagaLifecycle instance method to remove the given associationValue. If the current saga is not
associated with given value, this should do nothing.associationValue - the association value to removeprotected abstract void doAssociateWith(AssociationValue associationValue)
SagaLifecycle instance method to register the given associationValue. If the current saga is
already associated with given value, this should do nothing.associationValue - the association value to addprotected static SagaLifecycle getInstance()
SagaLifecycle instance for the current thread. If none exists an IllegalStateException is thrown.SagaLifecycleprotected void execute(Runnable task)
SagaLifecycle instance method to execute given task in the context of this SagaLifeCycle. This
updates the thread's current saga lifecycle before executing the task. If a lifecycle is already registered with
the current thread that one will be temporarily replaced with this lifecycle until the task completes.task - the task to executeprotected abstract String type()
String denoting the type of this Saga.String denoting the type of this Sagaprotected abstract String getSagaIdentifier()
String denoting the identifier of this Saga.String denoting the identifier of this Sagapublic ScopeDescriptor describeScope()
ScopeScope.describeScope in class ScopeScopeDescriptor describing this ScopeCopyright © 2010–2018. All rights reserved.