T
- a generic specifying the Saga type managed by this implementationpublic abstract static class AbstractSagaManager.Builder<T> extends Object
AbstractSagaManager
implementations.
The sagaFactory
is defaulted to a sagaType.newInstance()
call throwing a
SagaInstantiationException
if it fails, and the ListenerInvocationErrorHandler
is defaulted to
a LoggingErrorHandler
.
The SagaRepository
and sagaType
are hard requirements and as such should be provided.
Constructor and Description |
---|
Builder() |
Modifier and Type | Method and Description |
---|---|
AbstractSagaManager.Builder<T> |
listenerInvocationErrorHandler(ListenerInvocationErrorHandler listenerInvocationErrorHandler)
Sets the
ListenerInvocationErrorHandler invoked when an error occurs. |
AbstractSagaManager.Builder<T> |
sagaFactory(Supplier<T> sagaFactory)
Sets the
sagaFactory of type Supplier responsible for creating new Saga instances. |
AbstractSagaManager.Builder<T> |
sagaRepository(SagaRepository<T> sagaRepository)
Sets the
SagaRepository of generic type T used to save and load Saga instances. |
AbstractSagaManager.Builder<T> |
sagaType(Class<T> sagaType)
Sets the
sagaType as a Class managed by this instance. |
protected void |
validate()
Validates whether the fields contained in this Builder are set accordingly.
|
public AbstractSagaManager.Builder<T> sagaRepository(SagaRepository<T> sagaRepository)
SagaRepository
of generic type T
used to save and load Saga instances.sagaRepository
- a SagaRepository
of generic type T
used to save and load Saga instancespublic AbstractSagaManager.Builder<T> sagaType(Class<T> sagaType)
sagaType
as a Class
managed by this instance.sagaType
- the Class
specifying the type of Saga managed by this instancepublic AbstractSagaManager.Builder<T> sagaFactory(Supplier<T> sagaFactory)
sagaFactory
of type Supplier
responsible for creating new Saga instances.
Defaults to a sagaType.newInstance()
call throwing a SagaInstantiationException
if it fails.sagaFactory
- a Supplier
of Saga type T
responsible for creating new Saga instancespublic AbstractSagaManager.Builder<T> listenerInvocationErrorHandler(ListenerInvocationErrorHandler listenerInvocationErrorHandler)
ListenerInvocationErrorHandler
invoked when an error occurs. Defaults to a
LoggingErrorHandler
.listenerInvocationErrorHandler
- a ListenerInvocationErrorHandler
invoked when an error occursprotected void validate() throws AxonConfigurationException
AxonConfigurationException
- if one field is asserted to be incorrect according to the Builder's
specificationsCopyright © 2010–2019. All rights reserved.