Record Class UnitOfWorkConfiguration
java.lang.Object
java.lang.Record
org.axonframework.messaging.core.unitofwork.UnitOfWorkConfiguration
- Record Components:
workScheduler- TheExecutorfor 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 Summary
ConstructorsConstructorDescriptionUnitOfWorkConfiguration(Executor workScheduler, boolean allowAsyncProcessing) Creates an instance of aUnitOfWorkConfigurationrecord class. -
Method Summary
Modifier and TypeMethodDescriptionbooleanReturns the value of theallowAsyncProcessingrecord component.static UnitOfWorkConfigurationCreates default configuration with direct execution.final booleanIndicates whether some other object is "equal to" this one.Creates a newUnitOfWorkConfigurationthat forces all handlers to be invoked by the same thread.final inthashCode()Returns a hash code value for this object.final StringtoString()Returns a string representation of this record class.Returns the value of theworkSchedulerrecord component.workScheduler(Executor workScheduler) Creates new configuration with specified work scheduler.
-
Constructor Details
-
UnitOfWorkConfiguration
Creates an instance of aUnitOfWorkConfigurationrecord class.- Parameters:
workScheduler- the value for theworkSchedulerrecord componentallowAsyncProcessing- the value for theallowAsyncProcessingrecord component
-
-
Method Details
-
defaultValues
Creates default configuration with direct execution.- Returns:
- Default
UnitOfWorkConfigurationinstance.
-
workScheduler
Creates new configuration with specified work scheduler.- Parameters:
workScheduler- TheExecutorfor processing actions.- Returns:
- New
UnitOfWorkConfigurationwith updated work scheduler.
-
forcedSameThreadInvocation
Creates a newUnitOfWorkConfigurationthat 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
UnitOfWorkConfigurationinstance configured to enforce same-thread invocation.
-
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. -
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. -
equals
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 withObjects::equals(Object,Object); primitive components are compared with '=='. -
workScheduler
Returns the value of theworkSchedulerrecord component.- Returns:
- the value of the
workSchedulerrecord component
-
allowAsyncProcessing
public boolean allowAsyncProcessing()Returns the value of theallowAsyncProcessingrecord component.- Returns:
- the value of the
allowAsyncProcessingrecord component
-