Record Class UnitOfWorkConfiguration

java.lang.Object
java.lang.Record
org.axonframework.messaging.core.unitofwork.UnitOfWorkConfiguration
Record Components:
workScheduler - The Executor for processing unit of work actions.
allowAsyncProcessing - Whether the unit of work should allow fully asynchronous processing.
processingLifecycleEnhancers - The enhancers that are applied to the processing lifecycle for each created unit of work.

public record UnitOfWorkConfiguration(Executor workScheduler, boolean allowAsyncProcessing, List<Consumer<ProcessingLifecycle>> processingLifecycleEnhancers) extends Record
Configuration used for the UnitOfWork creation in the UnitOfWorkFactory.

Defines the work scheduler used during unit of work processing, and allows registering possible enhancers for a unit of work's lifecycle.

Since:
5.0.0
Author:
Mateusz Nowak, John Hendrikx
  • Constructor Details

  • Method Details

    • forcedSameThreadInvocation

      public UnitOfWorkConfiguration forcedSameThreadInvocation()
      Creates a new UnitOfWorkConfiguration that forces all handlers to be invoked by the same thread. The configuration uses a direct execution model where all tasks are run immediately on the calling thread, and the coordinating thread will wait for any asynchronous processing to complete.
      Returns:
      A new modified UnitOfWorkConfiguration.
    • workScheduler

      public UnitOfWorkConfiguration workScheduler(Executor workScheduler)
      Creates a new configuration with specified work scheduler.
      Parameters:
      workScheduler - The Executor for processing actions.
      Returns:
      A new modified UnitOfWorkConfiguration.
    • registerProcessingLifecycleEnhancer

      public UnitOfWorkConfiguration registerProcessingLifecycleEnhancer(Consumer<ProcessingLifecycle> enhancer)
      Creates a new configuration including the specified enhancer.
      Parameters:
      enhancer - The processing lifecycle enhancer to include.
      Returns:
      A new modified UnitOfWorkConfiguration.
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared with Objects::equals(Object,Object); primitive components are compared with '=='.
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • workScheduler

      public Executor workScheduler()
      Returns the value of the workScheduler record component.
      Returns:
      the value of the workScheduler record component
    • allowAsyncProcessing

      public boolean allowAsyncProcessing()
      Returns the value of the allowAsyncProcessing record component.
      Returns:
      the value of the allowAsyncProcessing record component
    • processingLifecycleEnhancers

      public List<Consumer<ProcessingLifecycle>> processingLifecycleEnhancers()
      Returns the value of the processingLifecycleEnhancers record component.
      Returns:
      the value of the processingLifecycleEnhancers record component