Package org.axonframework.modelling.saga
Class AbstractSagaManager.Builder<T>
java.lang.Object
org.axonframework.modelling.saga.AbstractSagaManager.Builder<T>
- Type Parameters:
T- a generic specifying the Saga type managed by this implementation
- Direct Known Subclasses:
AnnotatedSagaManager.Builder
- Enclosing class:
AbstractSagaManager<T>
Abstract Builder class to instantiate
AbstractSagaManager implementations.
The sagaFactory is defaulted to a sagaType.newInstance() call throwing a
SagaInstantiationException if it fails. The SagaRepository and sagaType are
hard requirements and as such should be provided.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionsagaFactory(Supplier<T> sagaFactory) Sets thesagaFactoryof typeSupplierresponsible for creating new Saga instances.sagaRepository(SagaRepository<T> sagaRepository) Sets theSagaRepositoryof generic typeTused to save and load Saga instances.Sets thesagaTypeas aClassmanaged by this instance.protected voidvalidate()Validates whether the fields contained in this Builder are set accordingly.
-
Field Details
-
sagaType
-
-
Constructor Details
-
Builder
public Builder()
-
-
Method Details
-
sagaRepository
Sets theSagaRepositoryof generic typeTused to save and load Saga instances.- Parameters:
sagaRepository- aSagaRepositoryof generic typeTused to save and load Saga instances- Returns:
- the current Builder instance, for fluent interfacing
-
sagaType
Sets thesagaTypeas aClassmanaged by this instance.- Parameters:
sagaType- theClassspecifying the type of Saga managed by this instance- Returns:
- the current Builder instance, for fluent interfacing
-
sagaFactory
Sets thesagaFactoryof typeSupplierresponsible for creating new Saga instances. Defaults to asagaType.newInstance()call throwing aSagaInstantiationExceptionif it fails.- Parameters:
sagaFactory- aSupplierof Saga typeTresponsible for creating new Saga instances- Returns:
- the current Builder instance, for fluent interfacing
-
validate
Validates whether the fields contained in this Builder are set accordingly.- Throws:
AxonConfigurationException- if one field is asserted to be incorrect according to the Builder's specifications
-