Interface DeadlineManager

All Superinterfaces:
MessageDispatchInterceptorSupport<DeadlineMessage<?>>, MessageHandlerInterceptorSupport<DeadlineMessage<?>>
All Known Implementing Classes:
AbstractDeadlineManager, DbSchedulerDeadlineManager, JobRunrDeadlineManager, QuartzDeadlineManager, SimpleDeadlineManager, StubDeadlineManager

Contract for deadline managers. Contains methods for scheduling a deadline and for cancelling a deadline.
Since:
3.3
Author:
Milan Savic, Steven van Beelen
  • Method Details

    • schedule

      default String schedule(@Nonnull Instant triggerDateTime, @Nonnull String deadlineName)
      Schedules a deadline at given triggerDateTime with given deadlineName. The payload of this deadline will be null, as none is provided. The returned scheduleId and provided deadlineName combination can be used to cancel the scheduled deadline. The scope within which this call is made will be retrieved by the DeadlineManager itself.
      Parameters:
      triggerDateTime - A Instant denoting the moment to trigger the deadline handling
      deadlineName - A String representing the name of the deadline to schedule
      Returns:
      the scheduleId as a String to use when cancelling the schedule
    • schedule

      default String schedule(@Nonnull Instant triggerDateTime, @Nonnull String deadlineName, @Nullable Object messageOrPayload)
      Schedules a deadline at given triggerDateTime with given deadlineName. The returned scheduleId and provided deadlineName combination 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 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.

      Parameters:
      triggerDateTime - A Instant denoting the moment to trigger the deadline handling
      deadlineName - A String representing the name of the deadline to schedule
      messageOrPayload - A Message or payload for a message as an Object
      Returns:
      the scheduleId as a String to use when cancelling the schedule
    • schedule

      String schedule(@Nonnull Instant triggerDateTime, @Nonnull String deadlineName, @Nullable Object messageOrPayload, @Nonnull ScopeDescriptor deadlineScope)
      Schedules a deadline at given triggerDateTime 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.

      Parameters:
      triggerDateTime - A Instant denoting the moment to trigger the deadline handling
      deadlineName - A String representing the name of the deadline to schedule
      messageOrPayload - A Message or payload for a message as an Object
      deadlineScope - A ScopeDescriptor describing the scope within which the deadline was scheduled
      Returns:
      the scheduleId as a String to use when cancelling the schedule
    • schedule

      default String schedule(@Nonnull Duration triggerDuration, @Nonnull String deadlineName)
      Schedules a deadline after the given triggerDuration with given deadlineName. The payload of this deadline will be null, as none is provided. The returned scheduleId and provided deadlineName combination can be used to cancel the scheduled deadline. The scope within which this call is made will be retrieved by the DeadlineManager itself.
      Parameters:
      triggerDuration - A Duration describing the waiting period before handling the deadline
      deadlineName - A String representing the name of the deadline to schedule
      Returns:
      the scheduleId as a String to use when cancelling the schedule
    • schedule

      default String schedule(@Nonnull Duration triggerDuration, @Nonnull String deadlineName, @Nullable Object messageOrPayload)
      Schedules a deadline after the given triggerDuration. The returned scheduleId and provided deadlineName combination 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 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.

      Parameters:
      triggerDuration - A Duration describing the waiting period before handling the deadline
      deadlineName - A String representing the name of the deadline to schedule
      messageOrPayload - A Message or payload for a message as an Object
      Returns:
      the scheduleId as a String to use when cancelling the schedule
    • schedule

      default String schedule(@Nonnull Duration triggerDuration, @Nonnull String deadlineName, @Nullable Object messageOrPayload, @Nonnull ScopeDescriptor deadlineScope)
      Schedules a deadline after the given triggerDuration with provided context. The provided deadlineName / scheduleId 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.

      Parameters:
      triggerDuration - A Duration describing the waiting period before handling the deadline
      deadlineName - A String representing the name of the deadline to schedule
      messageOrPayload - A Message or payload for a message as an Object
      deadlineScope - A ScopeDescriptor describing the scope within which the deadline was scheduled
      Returns:
      the scheduleId as a String to use when cancelling the schedule
    • cancelSchedule

      void cancelSchedule(@Nonnull String deadlineName, @Nonnull String scheduleId)
      Cancels the deadline corresponding to the given deadlineName / scheduleId combination. This method has no impact on deadlines which have already been triggered.
      Parameters:
      deadlineName - a String representing the name of the deadline to cancel
      scheduleId - the String denoting the scheduled deadline to cancel
    • cancelAll

      void cancelAll(@Nonnull String deadlineName)
      Cancels all the deadlines corresponding to the given deadlineName. This method has no impact on deadlines which have already been triggered.
      Parameters:
      deadlineName - a String representing the name of the deadlines to cancel
    • cancelAllWithinScope

      default void cancelAllWithinScope(@Nonnull String deadlineName)
      Cancels all deadlines corresponding to the given deadlineName that are scheduled within Scope.describeCurrentScope(). This method has no impact on deadlines which have already been triggered.
      Parameters:
      deadlineName - a String representing the name of the deadlines to cancel
    • cancelAllWithinScope

      void cancelAllWithinScope(@Nonnull String deadlineName, @Nonnull ScopeDescriptor scope)
      Cancels all deadlines corresponding to the given deadlineName and scope. This method has no impact on deadlines which have already been triggered.
      Parameters:
      deadlineName - a String representing the name of the deadlines to cancel
      scope - a ScopeDescriptor describing the scope within which the deadline was scheduled
    • shutdown

      default void shutdown()
      Shuts down this deadline manager.