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.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 Summary
ConstructorsConstructorDescriptionUnitOfWorkConfiguration(Executor workScheduler, boolean allowAsyncProcessing, List<Consumer<ProcessingLifecycle>> processingLifecycleEnhancers) Creates an instance of aUnitOfWorkConfigurationrecord class. -
Method Summary
Modifier and TypeMethodDescriptionbooleanReturns the value of theallowAsyncProcessingrecord component.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.Returns the value of theprocessingLifecycleEnhancersrecord component.Creates a new configuration including the specified enhancer.final StringtoString()Returns a string representation of this record class.Returns the value of theworkSchedulerrecord component.workScheduler(Executor workScheduler) Creates a new configuration with specified work scheduler.
-
Constructor Details
-
UnitOfWorkConfiguration
public UnitOfWorkConfiguration(Executor workScheduler, boolean allowAsyncProcessing, List<Consumer<ProcessingLifecycle>> processingLifecycleEnhancers) Creates an instance of aUnitOfWorkConfigurationrecord class.- Parameters:
workScheduler- the value for theworkSchedulerrecord componentallowAsyncProcessing- the value for theallowAsyncProcessingrecord componentprocessingLifecycleEnhancers- the value for theprocessingLifecycleEnhancersrecord component
-
-
Method Details
-
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 modified
UnitOfWorkConfiguration.
-
workScheduler
Creates a new configuration with specified work scheduler.- Parameters:
workScheduler- TheExecutorfor 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
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
-
processingLifecycleEnhancers
Returns the value of theprocessingLifecycleEnhancersrecord component.- Returns:
- the value of the
processingLifecycleEnhancersrecord component
-