Class ContextAwareScope

java.lang.Object
org.axonframework.messaging.Scope
org.axonframework.messaging.ContextAwareScope

@Internal public abstract class ContextAwareScope extends Scope
A Scope that also carries the ProcessingContext of the invocation it is started for.

Axon Framework 4 had two pieces of ambient state while a handler ran: the current Scope and the current unit of work. Code reached from that handler, such as a DeadlineManager, used the first to learn which Saga it was called from and the second to defer its work to the unit of work's prepare-commit phase. Axon Framework 5 hands the ProcessingContext to the handler explicitly and keeps no ambient unit of work. A ContextAwareScope brings both back for exactly the duration of one synchronous handler invocation, so that such code keeps working without a ProcessingContext parameter of its own.

Marked Internal because it only exists to bridge Axon Framework 4 APIs in this module. Axon Framework 5 components receive their ProcessingContext as a parameter and should never look it up through a Scope.

Since:
5.4.0
Author:
Mateusz Nowak