Package org.axonframework.messaging
Class Scope
java.lang.Object
org.axonframework.messaging.Scope
- Direct Known Subclasses:
AggregateLifecycle,SagaLifecycle
Describes functionality off processes which can be 'in scope', like an Aggregate or Saga.
- Since:
- 3.3
- Author:
- Steven van Beelen
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic ScopeDescriptorProvide a description of the currentScope.abstract ScopeDescriptorProvide a description of thisScope.protected voidendScope()protected <V> VexecuteWithResult(Callable<V> task) static <S extends Scope>
SRetrieve the currentScope.protected void
-
Constructor Details
-
Scope
public Scope()
-
-
Method Details
-
getCurrentScope
Retrieve the currentScope.- Type Parameters:
S- a type implementingScope- Returns:
- the current
Scope - Throws:
IllegalStateException- in case no currentScopeis active, in which case #startScope() should be called first
-
describeCurrentScope
Provide a description of the currentScope.- Returns:
- a
ScopeDescriptordescribing the currentScope
-
startScope
protected void startScope() -
endScope
protected void endScope()End aScopeby removingthisfrom aDequecontained in aThreadLocal. Ifthisisn't on the top of the Deque, anIllegalStateExceptionwill be thrown, as that signals a process is trying to end somebody else's scope. If the Deque is empty, it will be removed from the ThreadLocal. -
executeWithResult
Scopeinstance method to execute giventaskof typeCallablein the context of this Scope. This updates the thread's current scope before executing the task. If a scope is already registered with the current thread that one will be temporarily replaced with this scope until the task completes. This method returns the execution result of the task. -
describeScope
Provide a description of thisScope.- Returns:
- a
ScopeDescriptordescribing thisScope
-