Class TimeoutUnitOfWorkFactoryConfiguration

java.lang.Object
org.axonframework.messaging.core.timeout.TimeoutUnitOfWorkFactoryConfiguration

public class TimeoutUnitOfWorkFactoryConfiguration extends Object
Configuration for the timeout settings of an entire ProcessingContext, per bus or event processor.

Unlike HandlerTimeoutConfiguration, which times out an individual message handler invocation, these settings time out the full processing duration of a command bus, a query bus, or an event processor, including any work performed by other interceptors and the commit of the ProcessingContext itself.

Since:
5.4.0
Author:
Steven van Beelen
See Also:
  • Field Details

    • DEFAULT

      public static final TimeoutUnitOfWorkFactoryConfiguration DEFAULT
      The TimeoutUnitOfWorkFactoryConfiguration applied when no other TimeoutUnitOfWorkFactoryConfiguration component is registered, giving the command bus, query bus, and event processors alike a 60-second timeout, a 10-second warning threshold, and a 1-second warning interval, with no per-processor overrides.

      These match the defaults Spring Boot auto-configuration applies through TimeoutProperties, so unit-of-work-level timeout behavior is enabled out of the box regardless of whether an application uses Spring Boot. Construct a TimeoutUnitOfWorkFactoryConfiguration explicitly, or use this constant to disable the configuration.

    • DISABLED

      public static final TimeoutUnitOfWorkFactoryConfiguration DISABLED
      TimeoutUnitOfWorkFactoryConfiguration that disables UnitOfWorkFactory-specific timeout behavior.
  • Constructor Details

    • TimeoutUnitOfWorkFactoryConfiguration

      public TimeoutUnitOfWorkFactoryConfiguration(TaskTimeoutSettings commandBus, TaskTimeoutSettings queryBus, TaskTimeoutSettings eventProcessors, Map<String,TaskTimeoutSettings> eventProcessor)
      Creates a new TimeoutUnitOfWorkFactoryConfiguration with the given timeout settings.
      Parameters:
      commandBus - the timeout settings for the command bus
      queryBus - the timeout settings for the query bus
      eventProcessors - the timeout settings for event processors not present in the given eventProcessor map
      eventProcessor - the timeout settings for specific, named event processors, keyed by processor name
  • Method Details

    • getCommandBus

      public TaskTimeoutSettings getCommandBus()
      Retrieves the timeout settings for the command bus.
      Returns:
      the timeout settings for the command bus
    • getQueryBus

      public TaskTimeoutSettings getQueryBus()
      Retrieves the timeout settings for the query bus.
      Returns:
      the timeout settings for the query bus
    • getEventProcessors

      public TaskTimeoutSettings getEventProcessors()
      Retrieves the timeout settings for event processors not present in getEventProcessor().
      Returns:
      the default timeout settings for event processors
    • getEventProcessor

      public Map<String,TaskTimeoutSettings> getEventProcessor()
      Retrieves the timeout settings for specific, named event processors, keyed by processor name.
      Returns:
      the timeout settings for specific, named event processors
    • eventProcessorSettings

      public TaskTimeoutSettings eventProcessorSettings(@Nullable String processorName)
      Retrieves the timeout settings for the event processor with the given processorName, falling back to getEventProcessors() when no specific settings are registered for that name, or when processorName is null.
      Parameters:
      processorName - the name of the event processor to retrieve timeout settings for, may be null
      Returns:
      the timeout settings for the given processorName