DeadlineManager
component is responsible for scheduling deadlines and invoking @DeadlineHandler
when the deadline is met. The DeadlineManager
can be injected as a resource. It has two flavors: SimpleDeadlineManager
and QuartzDeadlineManager
Duration
after which it will be triggered (or an Instant
at which it will be triggered) and a deadline name.Scheduled Events or Scheduled DeadlinesUnlike Event Scheduling, when a deadline is triggered there will be no storing of the published message. Scheduling/Triggering a deadline does not involve anEventBus
(orEventStore
), hence the message is not stored.
deadlineId
which can be used to cancel the deadline. In most cases, storing this deadlineId
as a field within your Aggregate/Saga is the most convenient. Cancelling a deadline could come in handy when a certain event means that the previously scheduled deadline has become obsolete (e.g. there is a deadline for paying the invoice, but the client payed the amount which means that the deadline is obsolete and can be canceled).cancelAll(String deadlineName)
deadlineName
.cancelAllWithinScope(String deadlineName)
deadlineName
, within the Scope
the method is invoked in.ScopeDescriptor
from "aggregate instance X" will be used to cancel.cancelAllWithinScope(String deadlineName, ScopeDescriptor scope)
deadlineName
and ScopeDescriptor
.@DeadlineHandler
is invoked. A @DeadlineHandler
is a message handler like any other in Axon - it is possible to inject parameters for which ParameterResolver
s exist.The Scope of a DeadlineWhen scheduling a deadline, the context from where it was scheduled is taken into account. This means a scheduled deadline will only be triggered in its originating context. Thus any@DeadlineHandler
annotated function you wish to be called on a met deadline, must be in the same Aggregate/Saga from which is was scheduled.Axon calls this context aScope
. If necessary, implementing and providing your ownScope
will allow you to schedule deadlines in your custom, 'scoped' components.A Saga can end its lifecycle when@EndSaga
is added on a deadline handler.
@DeadlineHandler
is matched based on the deadline name and the deadline payload.@DeadlineHandler
, matching will proceed based on the deadline payload alone.@DeadlineHandler
does not have to specify the payload.GenericEventMessage.clock
. This clock is set to Clock.systemUTC at runtime, and manipulated to simulate time during testing.