Class DeadlineDelivery

java.lang.Object
org.axonframework.deadline.DeadlineDelivery

@Internal public final class DeadlineDelivery extends Object
Delivers a fired deadline to the ScopeAware components that resolve its scope, inside a unit of work from the configured UnitOfWorkFactory.

The registered handler interceptors run around the delivery, and both get the unit of work's ProcessingContext, which carries the deadline message. A component that fails to handle the deadline fails the delivery with an ExecutionException, as in Axon Framework 4, and the unit of work rolls back.

The components are taken from the ScopeAwareProvider before the unit of work starts, so that a provider waiting for the configuration to start does not keep a transaction open.

This class is internal, as it only serves the deadline managers of this module, which deliver fired deadlines in the same way.

Since:
5.4.0
Author:
Jakob Hatzl
  • Constructor Details

    • DeadlineDelivery

      public DeadlineDelivery(UnitOfWorkFactory unitOfWorkFactory, ScopeAwareProvider scopeAwareProvider, List<MessageHandlerInterceptor<? super DeadlineMessage>> handlerInterceptors)
      Creates a DeadlineDelivery delivering through the given components.
      Parameters:
      unitOfWorkFactory - the factory of the unit of work a fired deadline runs in
      scopeAwareProvider - the provider of the components that may resolve a deadline's scope
      handlerInterceptors - the handler interceptors to run around the delivery, read on every delivery
  • Method Details

    • deliver

      public void deliver(DeadlineMessage deadlineMessage, ScopeDescriptor deadlineScope)
      Delivers the given deadlineMessage to the components resolving the given deadlineScope, and waits for the unit of work to complete.
      Parameters:
      deadlineMessage - the fired deadline
      deadlineScope - the scope the deadline was scheduled for
      Throws:
      RuntimeException - the failure of a handler interceptor or the delivery unwrapped from the UnitOfWork, or the failure of the ScopeAwareProvider