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.

public record UnitOfWorkConfiguration(@Nonnull Executor workScheduler, boolean allowAsyncProcessing) extends Record
Configuration used for the UnitOfWork creation in the UnitOfWorkFactory.

Defines the work scheduler used during unit of work processing.

Since:
5.0.0
Author:
Mateusz Nowak
  • Constructor Details

    • UnitOfWorkConfiguration

      public UnitOfWorkConfiguration(@Nonnull Executor workScheduler, boolean allowAsyncProcessing)
      Creates an instance of a UnitOfWorkConfiguration record class.
      Parameters:
      workScheduler - the value for the workScheduler record component
      allowAsyncProcessing - the value for the allowAsyncProcessing record component
  • Method Details

    • defaultValues

      @Nonnull public static UnitOfWorkConfiguration defaultValues()
      Creates default configuration with direct execution.
      Returns:
      Default UnitOfWorkConfiguration instance.
    • workScheduler

      @Nonnull public UnitOfWorkConfiguration workScheduler(@Nonnull Executor workScheduler)
      Creates new configuration with specified work scheduler.
      Parameters:
      workScheduler - The Executor for processing actions.
      Returns:
      New UnitOfWorkConfiguration with updated work scheduler.
    • 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 UnitOfWorkConfiguration instance configured to enforce same-thread invocation.
    • 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

      @Nonnull 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