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 ListenerInvocationErrorHandler is defaulted to a
LoggingErrorHandler and the SagaManagerSpanFactory defaults to a
DefaultSagaManagerSpanFactory backed by a NoOpSpanFactory. The SagaRepository and
sagaType are hard requirements and as such should be provided.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionlistenerInvocationErrorHandler(org.axonframework.eventhandling.ListenerInvocationErrorHandler listenerInvocationErrorHandler) Sets theListenerInvocationErrorHandlerinvoked when an error occurs.sagaFactory(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.spanFactory(SagaManagerSpanFactory spanFactory) Sets theSagaManagerSpanFactoryimplementation to use for providing tracing capabilities.spanFactory(org.axonframework.tracing.SpanFactory spanFactory) Deprecated.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
-
listenerInvocationErrorHandler
public AbstractSagaManager.Builder<T> listenerInvocationErrorHandler(org.axonframework.eventhandling.ListenerInvocationErrorHandler listenerInvocationErrorHandler) Sets theListenerInvocationErrorHandlerinvoked when an error occurs. Defaults to aLoggingErrorHandler.- Parameters:
listenerInvocationErrorHandler- aListenerInvocationErrorHandlerinvoked when an error occurs- Returns:
- the current Builder instance, for fluent interfacing
-
spanFactory
@Deprecated public AbstractSagaManager.Builder<T> spanFactory(org.axonframework.tracing.SpanFactory spanFactory) Deprecated.Sets theSpanFactoryimplementation to use for providing tracing capabilities. Defaults to aNoOpSpanFactory, which provides no tracing capabilities.- Parameters:
spanFactory- TheSpanFactoryimplementation- Returns:
- The current Builder instance, for fluent interfacing.
-
spanFactory
Sets theSagaManagerSpanFactoryimplementation to use for providing tracing capabilities. Defaults to aDefaultSagaManagerSpanFactorybacked by aNoOpSpanFactoryby default, which provides no tracing capabilities.- Parameters:
spanFactory- TheSagaManagerSpanFactoryimplementation- Returns:
- The current Builder instance, for fluent interfacing.
-
validate
protected void validate() throws org.axonframework.common.AxonConfigurationExceptionValidates whether the fields contained in this Builder are set accordingly.- Throws:
org.axonframework.common.AxonConfigurationException- if one field is asserted to be incorrect according to the Builder's specifications
-
instead as it provides more configuration options.