T
- a generic specifying the Saga type contained in this SagaRepository
implementationpublic static class AnnotatedSagaRepository.Builder<T> extends LockingSagaRepository.Builder<T>
AnnotatedSagaRepository
.
The ResourceInjector
is defaulted to a NoResourceInjector
. 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 in this repository must be instanceOf
this saga type. Additionally, the
sagaType
and SagaStore
are hard requirements and as such should be provided.
Constructor and Description |
---|
Builder() |
Modifier and Type | Method and Description |
---|---|
AnnotatedSagaRepository<T> |
build()
Initializes a
AnnotatedSagaRepository as specified through this Builder. |
protected MessageHandlerInterceptorMemberChain<T> |
buildChainedInterceptor()
Instantiate the
MessageHandlerInterceptorMemberChain of generic type T as the Saga type to
be stored. |
protected SagaModel<T> |
buildSagaModel()
Instantiate the
SagaModel of generic type T describing the structure of the Saga this
SagaRepository will store. |
AnnotatedSagaRepository.Builder<T> |
handlerDefinition(HandlerDefinition handlerDefinition)
Sets the
HandlerDefinition used to create concrete handlers for the given sagaType . |
AnnotatedSagaRepository.Builder<T> |
interceptorMemberChain(MessageHandlerInterceptorMemberChain<T> interceptorMemberChain)
Sets the
MessageHandlerInterceptorMemberChain of generic type T , describing the structure of the Saga this
SagaRepository implementation will store. |
AnnotatedSagaRepository.Builder<T> |
lockFactory(LockFactory lockFactory)
Sets the
LockFactory used to lock a saga. |
AnnotatedSagaRepository.Builder<T> |
parameterResolverFactory(ParameterResolverFactory parameterResolverFactory)
Sets the
ParameterResolverFactory used to resolve parameters for annotated handlers for the given
sagaType . |
AnnotatedSagaRepository.Builder<T> |
resourceInjector(ResourceInjector resourceInjector)
Sets the
ResourceInjector used to initialize Saga instances after a target instance is
created or loaded from the store. |
AnnotatedSagaRepository.Builder<T> |
sagaModel(SagaModel<T> sagaModel)
Sets the
SagaModel of generic type T , describing the structure of the Saga this
SagaRepository implementation will store. |
AnnotatedSagaRepository.Builder<T> |
sagaStore(SagaStore<? super T> sagaStore)
Sets the
SagaStore used to save and load saga instances. |
AnnotatedSagaRepository.Builder<T> |
sagaType(Class<T> sagaType)
|
protected void |
validate()
Validates whether the fields contained in this Builder are set accordingly.
|
public AnnotatedSagaRepository.Builder<T> lockFactory(LockFactory lockFactory)
LockingSagaRepository.Builder
LockFactory
used to lock a saga. Defaults to a pessimistic locking strategy, implemented in
the PessimisticLockFactory
.lockFactory
in class LockingSagaRepository.Builder<T>
lockFactory
- a LockFactory
used to lock an aggregatepublic AnnotatedSagaRepository.Builder<T> sagaType(Class<T> sagaType)
sagaType
as a Class
, specifying the type of Saga this SagaRepository
will
store. If no SagaModel
is specified directly, a model will be derived from this type.sagaType
- the Class
specifying the type of Saga this SagaRepository
will storepublic AnnotatedSagaRepository.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 for the given sagaType
public AnnotatedSagaRepository.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 AnnotatedSagaRepository.Builder<T> sagaModel(SagaModel<T> sagaModel)
SagaModel
of generic type T
, describing the structure of the Saga this
SagaRepository
implementation will store. 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 SagaRepository
implementation will storepublic AnnotatedSagaRepository.Builder<T> sagaStore(SagaStore<? super T> sagaStore)
SagaStore
used to save and load saga instances.sagaStore
- the SagaStore
used to save and load saga instancespublic AnnotatedSagaRepository.Builder<T> resourceInjector(ResourceInjector resourceInjector)
ResourceInjector
used to initialize Saga
instances after a target instance is
created or loaded from the store. Defaults to a NoResourceInjector
.resourceInjector
- a ResourceInjector
used to initialize Saga
instances after a target
instance is created or loaded from the storepublic AnnotatedSagaRepository.Builder<T> interceptorMemberChain(MessageHandlerInterceptorMemberChain<T> interceptorMemberChain)
MessageHandlerInterceptorMemberChain
of generic type T
, describing the structure of the Saga this
SagaRepository
implementation will store. To be used in handling the event messages.interceptorMemberChain
- the MessageHandlerInterceptorMemberChain
of generic type T
of the Saga this SagaRepository
implementation will storepublic AnnotatedSagaRepository<T> build()
AnnotatedSagaRepository
as specified through this Builder.AnnotatedSagaRepository
as specified through this Builderprotected SagaModel<T> buildSagaModel()
SagaModel
of generic type T
describing the structure of the Saga this
SagaRepository
will store.SagaModel
of generic type T
describing the Saga this SagaRepository
implementation will storeprotected MessageHandlerInterceptorMemberChain<T> buildChainedInterceptor()
MessageHandlerInterceptorMemberChain
of generic type T
as the Saga type to
be stored. To be used in handling the event messages.MessageHandlerInterceptorMemberChain
of generic type T
. To be used in handling the
event messages.protected void validate() throws AxonConfigurationException
validate
in class LockingSagaRepository.Builder<T>
AxonConfigurationException
- if one field is asserted to be incorrect according to the Builder's
specificationsCopyright © 2010–2024. All rights reserved.