T
- a generic specifying the Saga type managed by this AbstractSagaManager
implementationpublic static class AnnotatedSagaManager.Builder<T> extends AbstractSagaManager.Builder<T>
AnnotatedSagaManager
.
The sagaFactory
is defaulted to a sagaType.newInstance()
call throwing a
SagaInstantiationException
if it fails, the SpanFactory
defaults to a
NoOpSpanFactory
, and the ListenerInvocationErrorHandler
is defaulted to
a LoggingErrorHandler
.
This Builder either allows directly setting a SagaModel
of generic type T
, or it will generate
one based of the required sagaType
field of type Class
. Thus, either the SagaModel or the
sagaType
should be provided. All Sagas managed by this instances must be instanceOf
this saga
type. Additionally, the SagaRepository
and sagaType
are hard requirements and as such
should be provided.
sagaType
Constructor and Description |
---|
Builder() |
Modifier and Type | Method and Description |
---|---|
AnnotatedSagaManager<T> |
build()
Initializes a
AnnotatedSagaManager as specified through this Builder. |
protected SagaModel<T> |
buildSagaModel()
Instantiate the
SagaModel of generic type T describing the structure of the Saga
this AbstractSagaManager implementation will manage. |
AnnotatedSagaManager.Builder<T> |
handlerDefinition(HandlerDefinition handlerDefinition)
Sets the
HandlerDefinition used to create concrete handlers for the given sagaType . |
AnnotatedSagaManager.Builder<T> |
listenerInvocationErrorHandler(ListenerInvocationErrorHandler listenerInvocationErrorHandler)
Sets the
ListenerInvocationErrorHandler invoked when an error occurs. |
AnnotatedSagaManager.Builder<T> |
parameterResolverFactory(ParameterResolverFactory parameterResolverFactory)
Sets the
ParameterResolverFactory used to resolve parameters for annotated handlers for the given
sagaType . |
AnnotatedSagaManager.Builder<T> |
sagaFactory(Supplier<T> sagaFactory)
Sets the
sagaFactory of type Supplier responsible for creating new Saga instances. |
AnnotatedSagaManager.Builder<T> |
sagaModel(SagaModel<T> sagaModel)
Sets the
SagaModel of generic type T , describing the structure of the Saga this
AbstractSagaManager implementation will manage. |
AnnotatedSagaManager.Builder<T> |
sagaRepository(SagaRepository<T> sagaRepository)
Sets the
SagaRepository of generic type T used to save and load Saga instances. |
AnnotatedSagaManager.Builder<T> |
sagaType(Class<T> sagaType)
Sets the
sagaType as a Class managed by this instance. |
AnnotatedSagaManager.Builder<T> |
spanFactory(SpanFactory spanFactory)
Sets the
SpanFactory implementation to use for providing tracing capabilities. |
validate
public AnnotatedSagaManager.Builder<T> sagaRepository(SagaRepository<T> sagaRepository)
AbstractSagaManager.Builder
SagaRepository
of generic type T
used to save and load Saga instances.sagaRepository
in class AbstractSagaManager.Builder<T>
sagaRepository
- a SagaRepository
of generic type T
used to save and load Saga instancespublic AnnotatedSagaManager.Builder<T> sagaType(Class<T> sagaType)
AbstractSagaManager.Builder
sagaType
as a Class
managed by this instance.sagaType
in class AbstractSagaManager.Builder<T>
sagaType
- the Class
specifying the type of Saga managed by this instancepublic AnnotatedSagaManager.Builder<T> sagaFactory(Supplier<T> sagaFactory)
AbstractSagaManager.Builder
sagaFactory
of type Supplier
responsible for creating new Saga instances.
Defaults to a sagaType.newInstance()
call throwing a SagaInstantiationException
if it fails.sagaFactory
in class AbstractSagaManager.Builder<T>
sagaFactory
- a Supplier
of Saga type T
responsible for creating new Saga instancespublic AnnotatedSagaManager.Builder<T> listenerInvocationErrorHandler(ListenerInvocationErrorHandler listenerInvocationErrorHandler)
AbstractSagaManager.Builder
ListenerInvocationErrorHandler
invoked when an error occurs. Defaults to a
LoggingErrorHandler
.listenerInvocationErrorHandler
in class AbstractSagaManager.Builder<T>
listenerInvocationErrorHandler
- a ListenerInvocationErrorHandler
invoked when an error occurspublic AnnotatedSagaManager.Builder<T> spanFactory(SpanFactory spanFactory)
AbstractSagaManager.Builder
SpanFactory
implementation to use for providing tracing capabilities. Defaults to a
NoOpSpanFactory
by default, which provides no tracing capabilities.spanFactory
in class AbstractSagaManager.Builder<T>
spanFactory
- The SpanFactory
implementationpublic AnnotatedSagaManager.Builder<T> parameterResolverFactory(ParameterResolverFactory parameterResolverFactory)
ParameterResolverFactory
used to resolve parameters for annotated handlers for the given
sagaType
. Only used to instantiate a SagaModel
if no SagaModel has been provided directly.parameterResolverFactory
- a ParameterResolverFactory
used to resolve parameters for annotated
handlers contained in the Aggregatepublic AnnotatedSagaManager.Builder<T> handlerDefinition(HandlerDefinition handlerDefinition)
HandlerDefinition
used to create concrete handlers for the given sagaType
.
Only used to instantiate a SagaModel
if no SagaModel has been provided directly.handlerDefinition
- a HandlerDefinition
used to create concrete handlers for the given
sagaType
.public AnnotatedSagaManager.Builder<T> sagaModel(SagaModel<T> sagaModel)
SagaModel
of generic type T
, describing the structure of the Saga this
AbstractSagaManager
implementation will manage. If this is not provided directly, the
sagaType
will be used to instantiate a SagaModel.sagaModel
- the SagaModel
of generic type T
of the Saga this AbstractSagaManager
implementation will managepublic AnnotatedSagaManager<T> build()
AnnotatedSagaManager
as specified through this Builder.AnnotatedSagaManager
as specified through this Builderprotected SagaModel<T> buildSagaModel()
SagaModel
of generic type T
describing the structure of the Saga
this AbstractSagaManager
implementation will manage.SagaModel
of generic type T
describing the Saga this
AbstractSagaManager
implementation will manageCopyright © 2010–2023. All rights reserved.