Class SimpleUnitOfWorkFactory
java.lang.Object
org.axonframework.messaging.core.unitofwork.SimpleUnitOfWorkFactory
- All Implemented Interfaces:
UnitOfWorkFactory
Factory for creating simple
UnitOfWork instances. This factory allows for the creation of UnitOfWork
instances with a default configuration, which can be customized using a provided function.- Since:
- 5.0.0
- Author:
- Mateusz Nowak
-
Constructor Summary
ConstructorsConstructorDescriptionSimpleUnitOfWorkFactory(ApplicationContext applicationContext) Initializes aSimpleUnitOfWorkFactorywith the default configuration.SimpleUnitOfWorkFactory(ApplicationContext applicationContext, Function<UnitOfWorkConfiguration, UnitOfWorkConfiguration> factoryCustomization) Initializes aSimpleUnitOfWorkFactorywith the givenApplicationContextand customization function. -
Method Summary
Modifier and TypeMethodDescriptioncreate(String identifier, Function<UnitOfWorkConfiguration, UnitOfWorkConfiguration> customization) Creates a newUnitOfWorkwith the given identifier and applies the provided customization to its configuration.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.axonframework.messaging.core.unitofwork.UnitOfWorkFactory
create, create, create
-
Constructor Details
-
SimpleUnitOfWorkFactory
Initializes aSimpleUnitOfWorkFactorywith the default configuration. This constructor uses the default configuration for creatingUnitOfWorkinstances without any customizations.- Parameters:
applicationContext- TheApplicationContextfor component resolution in createdUnitOfWorkinstances.
-
SimpleUnitOfWorkFactory
public SimpleUnitOfWorkFactory(ApplicationContext applicationContext, Function<UnitOfWorkConfiguration, UnitOfWorkConfiguration> factoryCustomization) Initializes aSimpleUnitOfWorkFactorywith the givenApplicationContextand customization function. Allows customizing the default configuration used to createUnitOfWorkinstances by this factory.- Parameters:
applicationContext- TheApplicationContextfor component resolution in createdUnitOfWorkinstances.factoryCustomization- The function to customize theUnitOfWorkConfigurationused to createUnitOfWorkinstances.
-
-
Method Details
-
create
public UnitOfWork create(String identifier, Function<UnitOfWorkConfiguration, UnitOfWorkConfiguration> customization) Description copied from interface:UnitOfWorkFactoryCreates a newUnitOfWorkwith the given identifier and applies the provided customization to its configuration.- Specified by:
createin interfaceUnitOfWorkFactory- Parameters:
identifier- The identifier for the unit of work.customization- A function to customize the unit of work's configuration.- Returns:
- A new
UnitOfWorkinstance.
-