public class DbSchedulerDeadlineManager extends AbstractDeadlineManager implements Lifecycle
DeadlineManager that delegates scheduling and triggering to a db scheduler
Scheduler.| Modifier and Type | Class and Description |
|---|---|
static class |
DbSchedulerDeadlineManager.Builder
Builder class to instantiate a
DbSchedulerDeadlineManager. |
Lifecycle.LifecycleHandler, Lifecycle.LifecycleRegistry| Modifier | Constructor and Description |
|---|---|
protected |
DbSchedulerDeadlineManager(DbSchedulerDeadlineManager.Builder builder)
Instantiate a
DbSchedulerDeadlineManager based on the fields contained in the
DbSchedulerDeadlineManager.Builder. |
| Modifier and Type | Method and Description |
|---|---|
static com.github.kagkarlsson.scheduler.task.Task<DbSchedulerBinaryDeadlineDetails> |
binaryTask(Supplier<DbSchedulerDeadlineManager> deadlineManagerSupplier)
|
static DbSchedulerDeadlineManager.Builder |
builder()
Instantiate a Builder to be able to create a
DbSchedulerDeadlineManager. |
void |
cancelAll(String deadlineName)
Cancels all the deadlines corresponding to the given
deadlineName. |
void |
cancelAllWithinScope(String deadlineName,
ScopeDescriptor scope)
Cancels all deadlines corresponding to the given
deadlineName and scope. |
void |
cancelSchedule(String deadlineName,
String scheduleId)
Cancels the deadline corresponding to the given
deadlineName / scheduleId combination. |
static com.github.kagkarlsson.scheduler.task.Task<DbSchedulerHumanReadableDeadlineDetails> |
humanReadableTask(Supplier<DbSchedulerDeadlineManager> deadlineManagerSupplier)
|
void |
registerLifecycleHandlers(Lifecycle.LifecycleRegistry lifecycle)
Registers the activities to be executed in the various phases of an application's lifecycle.
|
String |
schedule(Instant triggerDateTime,
String deadlineName,
Object messageOrPayload,
ScopeDescriptor deadlineScope)
Schedules a deadline at given
triggerDateTime with provided context. |
void |
shutdown()
Shuts down this deadline manager.
|
void |
start()
Will start the
Scheduler depending on its current state and the value of startScheduler, |
dispatchInterceptors, handlerInterceptors, processDispatchInterceptors, registerDispatchInterceptor, registerHandlerInterceptor, runOnPrepareCommitOrNowclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitcancelAllWithinScope, schedule, schedule, schedule, schedule, scheduleprotected DbSchedulerDeadlineManager(DbSchedulerDeadlineManager.Builder builder)
DbSchedulerDeadlineManager based on the fields contained in the
DbSchedulerDeadlineManager.Builder.
Will assert that the ScopeAwareProvider, Scheduler and Serializer are not null,
and will throw an AxonConfigurationException if any of them is null.
builder - the DbSchedulerDeadlineManager.Builder used to instantiate a
DbSchedulerDeadlineManager instancepublic static DbSchedulerDeadlineManager.Builder builder()
DbSchedulerDeadlineManager.
The TransactionManager is defaulted to a NoTransactionManager.
The DeadlineManagerSpanFactory is defaulted to a DefaultDeadlineManagerSpanFactory backed by a NoOpSpanFactory.
The useBinaryPojo and startScheduler are defaulted to true.
The Scheduler, ScopeAwareProvider and Serializer are hard requirements and as such
should be provided.
DbSchedulerDeadlineManagerpublic String schedule(@Nonnull Instant triggerDateTime, @Nonnull String deadlineName, @Nullable Object messageOrPayload, @Nonnull ScopeDescriptor deadlineScope)
DeadlineManagertriggerDateTime with provided context. The returned scheduleId and
provided deadlineName combination can be used to cancel the scheduled deadline.
The given messageOrPayload may be any object, as well as a DeadlineMessage. In the latter case, the
instance provided is the donor for the payload and MetaData of the actual
deadline being used. In the former case, the given messageOrPayload will be wrapped as the payload of a
DeadlineMessage.
schedule in interface DeadlineManagertriggerDateTime - A Instant denoting the moment to trigger the deadline handlingdeadlineName - A String representing the name of the deadline to schedulemessageOrPayload - A Message or payload for a message as an
ObjectdeadlineScope - A ScopeDescriptor describing the scope within which the deadline was scheduledscheduleId as a String to use when cancelling the schedulepublic static com.github.kagkarlsson.scheduler.task.Task<DbSchedulerBinaryDeadlineDetails> binaryTask(Supplier<DbSchedulerDeadlineManager> deadlineManagerSupplier)
Task using DbSchedulerBinaryDeadlineDetails to execute a deadline via a
Scheduler. To be able to execute the task, this should be added to the task list, used to create the
scheduler.deadlineManagerSupplier - a Supplier of a DbSchedulerDeadlineManager. Preferably a method
involving dependency injection is used. When those are not available the
DbSchedulerDeadlineManagerSupplier can be used instead.Task to execute a deadlinepublic static com.github.kagkarlsson.scheduler.task.Task<DbSchedulerHumanReadableDeadlineDetails> humanReadableTask(Supplier<DbSchedulerDeadlineManager> deadlineManagerSupplier)
Task using DbSchedulerHumanReadableDeadlineDetails to execute a deadline via a
Scheduler. To be able to execute the task, this should be added to the task list, used to create the
scheduler.deadlineManagerSupplier - a Supplier of a DbSchedulerDeadlineManager. Preferably a method
involving dependency injection is used. When those are not available the
DbSchedulerDeadlineManagerSupplier can be used instead.Task to execute a deadlinepublic void cancelSchedule(@Nonnull String deadlineName, @Nonnull String scheduleId)
DeadlineManagerdeadlineName / scheduleId combination. This
method has no impact on deadlines which have already been triggered.cancelSchedule in interface DeadlineManagerdeadlineName - a String representing the name of the deadline to cancelscheduleId - the String denoting the scheduled deadline to cancelpublic void cancelAll(@Nonnull String deadlineName)
DeadlineManagerdeadlineName. This method has no impact on deadlines
which have already been triggered.cancelAll in interface DeadlineManagerdeadlineName - a String representing the name of the deadlines to cancelpublic void cancelAllWithinScope(@Nonnull String deadlineName, @Nonnull ScopeDescriptor scope)
DeadlineManagerdeadlineName and scope.
This method has no impact on deadlines which have already been triggered.cancelAllWithinScope in interface DeadlineManagerdeadlineName - a String representing the name of the deadlines to cancelscope - a ScopeDescriptor describing the scope within which the deadline was scheduledpublic void start()
Scheduler depending on its current state and the value of startScheduler,public void shutdown()
DeadlineManagershutdown in interface DeadlineManagerpublic void registerLifecycleHandlers(@Nonnull Lifecycle.LifecycleRegistry lifecycle)
LifecycleregisterLifecycleHandlers in interface Lifecyclelifecycle - the lifecycle instance to register the handlers withLifecycle.LifecycleRegistry.onShutdown(int, Runnable),
LifecycleRegistry#onShutdown(int, LifecycleHandler),
Lifecycle.LifecycleRegistry.onStart(int, Runnable),
LifecycleRegistry#onStart(int, LifecycleHandler)Copyright © 2010–2025. All rights reserved.