Class AbstractDeadlineManager

java.lang.Object
org.axonframework.deadline.AbstractDeadlineManager
All Implemented Interfaces:
DeadlineManager, MessageDispatchInterceptorSupport<DeadlineMessage<?>>, MessageHandlerInterceptorSupport<DeadlineMessage<?>>
Direct Known Subclasses:
DbSchedulerDeadlineManager, JobRunrDeadlineManager, QuartzDeadlineManager, SimpleDeadlineManager

public abstract class AbstractDeadlineManager extends Object implements DeadlineManager
Abstract implementation of the DeadlineManager to be implemented by concrete solutions for the DeadlineManager. Provides functionality to perform a call to the DeadlineManager in the a UnitOfWork it's 'prepare commit' phase. This #runOnPrepareCommitOrNow(Runnable) functionality is required, as the DeadlineManager schedules a Message which needs to happen on order with the other messages published throughout the system.
Since:
3.3
Author:
Steven van Beelen
  • Constructor Details

    • AbstractDeadlineManager

      public AbstractDeadlineManager()
  • Method Details

    • runOnPrepareCommitOrNow

      protected void runOnPrepareCommitOrNow(Runnable deadlineCall)
      Run a given deadlineCall immediately, or schedule it for the UnitOfWork it's 'prepare commit' phase if a UnitOfWork is active. This is required as the DeadlineManager schedule message which we want to happen on order with other message being handled.
      Parameters:
      deadlineCall - a Runnable to be executed now or on prepare commit if a UnitOfWork is active
    • registerDispatchInterceptor

      public Registration registerDispatchInterceptor(@Nonnull MessageDispatchInterceptor<? super DeadlineMessage<?>> dispatchInterceptor)
      Description copied from interface: MessageDispatchInterceptorSupport
      Register the given DispatchInterceptor. After registration, the interceptor will be invoked for each Message dispatched on the messaging component that it was registered to.
      Specified by:
      registerDispatchInterceptor in interface MessageDispatchInterceptorSupport<DeadlineMessage<?>>
      Parameters:
      dispatchInterceptor - The interceptor to register
      Returns:
      A Registration, which may be used to deregister the interceptor.
    • registerHandlerInterceptor

      public Registration registerHandlerInterceptor(@Nonnull MessageHandlerInterceptor<? super DeadlineMessage<?>> handlerInterceptor)
      Description copied from interface: MessageHandlerInterceptorSupport
      Register the given handlerInterceptor. After registration, the interceptor will be invoked for each handled Message on the messaging component that it was registered to, prior to invoking the message's handler.
      Specified by:
      registerHandlerInterceptor in interface MessageHandlerInterceptorSupport<DeadlineMessage<?>>
      Parameters:
      handlerInterceptor - The interceptor to register
      Returns:
      A Registration, which may be used to deregister the interceptor.
    • dispatchInterceptors

      protected List<MessageDispatchInterceptor<? super DeadlineMessage<?>>> dispatchInterceptors()
      Provides a list of registered dispatch interceptors. Do note that this list is not modifiable, and that changes in the internal structure for dispatch interceptors will be reflected in this list.
      Returns:
      a list of dispatch interceptors
    • handlerInterceptors

      protected List<MessageHandlerInterceptor<? super DeadlineMessage<?>>> handlerInterceptors()
      Provides a list of registered handler interceptors. Do note that this list is not modifiable, and that changes in the internal structure for handler interceptors will be reflected in this list.
      Returns:
      a list of handler interceptors
    • processDispatchInterceptors

      protected <T> DeadlineMessage<T> processDispatchInterceptors(DeadlineMessage<T> message)
      Applies registered MessageDispatchInterceptors to the given message.
      Type Parameters:
      T - the type of deadline message payload
      Parameters:
      message - the deadline message to be intercepted
      Returns:
      intercepted message