Interface DeadlineManager
- All Known Implementing Classes:
AbstractDeadlineManager,DbSchedulerDeadlineManager,JobRunrDeadlineManager,QuartzDeadlineManager,SimpleDeadlineManager,StubDeadlineManager
The overloads that take no ScopeDescriptor use Scope.describeCurrentScope(), as in Axon Framework
4. A Saga is the current Scope while one of its handler methods runs, so calling them from a Saga handler
schedules or cancels within that Saga's scope, regardless of how the DeadlineManager was obtained. Calling
them while no scope is active throws an IllegalStateException.
This contract exists to keep deadlines that were scheduled with Axon Framework 4 firing while migrating. Scheduling new deadlines is therefore deprecated, while cancelling them stays fully supported.
- Since:
- 3.3
- Author:
- Milan Savic, Steven van Beelen
-
Method Summary
Modifier and TypeMethodDescriptionvoidCancels all the deadlines corresponding to the givendeadlineName.default voidcancelAllWithinScope(String deadlineName) Cancels all deadlines corresponding to the givendeadlineNamethat are scheduled withinScope.describeCurrentScope().voidcancelAllWithinScope(String deadlineName, ScopeDescriptor scope) Cancels all deadlines corresponding to the givendeadlineNameandscope.voidcancelSchedule(String deadlineName, String scheduleId) Cancels the deadline corresponding to the givendeadlineName/scheduleIdcombination.default StringDeprecated.default StringDeprecated.scheduling new deadlines through aDeadlineManageris supported only to keep Axon Framework 4 code running while migrating.default Stringschedule(Duration triggerDuration, String deadlineName, @Nullable Object messageOrPayload, ScopeDescriptor deadlineScope) Deprecated.scheduling new deadlines through aDeadlineManageris supported only to keep Axon Framework 4 code running while migrating.default StringDeprecated.scheduling new deadlines through aDeadlineManageris supported only to keep Axon Framework 4 code running while migrating.default StringDeprecated.scheduling new deadlines through aDeadlineManageris supported only to keep Axon Framework 4 code running while migrating.schedule(Instant triggerDateTime, String deadlineName, @Nullable Object messageOrPayload, ScopeDescriptor deadlineScope) Deprecated.scheduling new deadlines through aDeadlineManageris supported only to keep Axon Framework 4 code running while migrating.default voidshutdown()Shuts down this deadline manager.
-
Method Details
-
schedule
Deprecated.scheduling new deadlines through aDeadlineManageris supported only to keep Axon Framework 4 code running while migrating. Schedule a command with a scheduler of choice that dispatches it through theCommandGatewayinstead, or replace the Saga with a WorkflowSchedules a deadline at giventriggerDateTimewith givendeadlineName. The payload of this deadline will benull, as none is provided. The returnedscheduleIdand provideddeadlineNamecombination can be used to cancel the scheduled deadline. The scope within which this call is made will be retrieved by the DeadlineManager itself. -
schedule
@Deprecated(since="5.4.0") default String schedule(Instant triggerDateTime, String deadlineName, @Nullable Object messageOrPayload) Deprecated.scheduling new deadlines through aDeadlineManageris supported only to keep Axon Framework 4 code running while migrating. Schedule a command with a scheduler of choice that dispatches it through theCommandGatewayinstead, or replace the Saga with a WorkflowSchedules a deadline at giventriggerDateTimewith givendeadlineName. The returnedscheduleIdand provideddeadlineNamecombination can be used to cancel the scheduled deadline. The scope within which this call is made will be retrieved by the DeadlineManager itself.The given
messageOrPayloadmay be any object, as well as a DeadlineMessage. In the latter case, the instance provided is the donor for the payload andMetadataof the actual deadline being used. In the former case, the givenmessageOrPayloadwill be wrapped as the payload of aDeadlineMessage.- Parameters:
triggerDateTime- aInstantdenoting the moment to trigger the deadline handlingdeadlineName- aStringrepresenting the name of the deadline to schedulemessageOrPayload- aMessageor payload for a message as anObject- Returns:
- the
scheduleIdas aStringto use when cancelling the schedule
-
schedule
@Deprecated(since="5.4.0") String schedule(Instant triggerDateTime, String deadlineName, @Nullable Object messageOrPayload, ScopeDescriptor deadlineScope) Deprecated.scheduling new deadlines through aDeadlineManageris supported only to keep Axon Framework 4 code running while migrating. Schedule a command with a scheduler of choice that dispatches it through theCommandGatewayinstead, or replace the Saga with a WorkflowSchedules a deadline at giventriggerDateTimewith provided context. The returnedscheduleIdand provideddeadlineNamecombination can be used to cancel the scheduled deadline.The given
messageOrPayloadmay be any object, as well as a DeadlineMessage. In the latter case, the instance provided is the donor for the payload andMetadataof the actual deadline being used. In the former case, the givenmessageOrPayloadwill be wrapped as the payload of aDeadlineMessage.- Parameters:
triggerDateTime- aInstantdenoting the moment to trigger the deadline handlingdeadlineName- aStringrepresenting the name of the deadline to schedulemessageOrPayload- aMessageor payload for a message as anObjectdeadlineScope- aScopeDescriptordescribing the scope within which the deadline was scheduled- Returns:
- the
scheduleIdas aStringto use when cancelling the schedule
-
schedule
Deprecated.scheduling new deadlines through aDeadlineManageris supported only to keep Axon Framework 4 code running while migrating. Schedule a command with a scheduler of choice that dispatches it through theCommandGatewayinstead, or replace the Saga with a WorkflowSchedules a deadline after the giventriggerDurationwith givendeadlineName. The payload of this deadline will benull, as none is provided. The returnedscheduleIdand provideddeadlineNamecombination can be used to cancel the scheduled deadline. The scope within which this call is made will be retrieved by the DeadlineManager itself. -
schedule
@Deprecated(since="5.4.0") default String schedule(Duration triggerDuration, String deadlineName, @Nullable Object messageOrPayload) Deprecated.scheduling new deadlines through aDeadlineManageris supported only to keep Axon Framework 4 code running while migrating. Schedule a command with a scheduler of choice that dispatches it through theCommandGatewayinstead, or replace the Saga with a WorkflowSchedules a deadline after the giventriggerDuration. The returnedscheduleIdand provideddeadlineNamecombination can be used to cancel the scheduled deadline. The scope within which this call is made will be retrieved by the DeadlineManager itself.The given
messageOrPayloadmay be any object, as well as a DeadlineMessage. In the latter case, the instance provided is the donor for the payload andMetadataof the actual deadline being used. In the former case, the givenmessageOrPayloadwill be wrapped as the payload of aDeadlineMessage.- Parameters:
triggerDuration- aDurationdescribing the waiting period before handling the deadlinedeadlineName- aStringrepresenting the name of the deadline to schedulemessageOrPayload- aMessageor payload for a message as anObject- Returns:
- the
scheduleIdas aStringto use when cancelling the schedule
-
schedule
@Deprecated(since="5.4.0") default String schedule(Duration triggerDuration, String deadlineName, @Nullable Object messageOrPayload, ScopeDescriptor deadlineScope) Deprecated.scheduling new deadlines through aDeadlineManageris supported only to keep Axon Framework 4 code running while migrating. Schedule a command with a scheduler of choice that dispatches it through theCommandGatewayinstead, or replace the Saga with a WorkflowSchedules a deadline after the giventriggerDurationwith provided context. The provideddeadlineName/scheduleIdcombination can be used to cancel the scheduled deadline.The given
messageOrPayloadmay be any object, as well as a DeadlineMessage. In the latter case, the instance provided is the donor for the payload andMetadataof the actual deadline being used. In the former case, the givenmessageOrPayloadwill be wrapped as the payload of aDeadlineMessage.- Parameters:
triggerDuration- aDurationdescribing the waiting period before handling the deadlinedeadlineName- aStringrepresenting the name of the deadline to schedulemessageOrPayload- aMessageor payload for a message as anObjectdeadlineScope- aScopeDescriptordescribing the scope within which the deadline was scheduled- Returns:
- the
scheduleIdas aStringto use when cancelling the schedule
-
cancelSchedule
Cancels the deadline corresponding to the givendeadlineName/scheduleIdcombination. This method has no impact on deadlines which have already been triggered. -
cancelAll
Cancels all the deadlines corresponding to the givendeadlineName. This method has no impact on deadlines which have already been triggered.- Parameters:
deadlineName- aStringrepresenting the name of the deadlines to cancel
-
cancelAllWithinScope
Cancels all deadlines corresponding to the givendeadlineNamethat are scheduled withinScope.describeCurrentScope(). This method has no impact on deadlines which have already been triggered.- Parameters:
deadlineName- aStringrepresenting the name of the deadlines to cancel
-
cancelAllWithinScope
Cancels all deadlines corresponding to the givendeadlineNameandscope. This method has no impact on deadlines which have already been triggered.- Parameters:
deadlineName- aStringrepresenting the name of the deadlines to cancelscope- aScopeDescriptordescribing the scope within which the deadline was scheduled
-
shutdown
default void shutdown()Shuts down this deadline manager.The configuration calls this method for every
DeadlineManagerit holds when the application shuts down, through theDeadlineManagerLifecycleConfigurationEnhancer. As the method may be called more than once, for example by Spring as the destroy method it infers for a@Bean, implementations have to allow repeated calls: every call after the first has no effect.
-
DeadlineManageris supported only to keep Axon Framework 4 code running while migrating.