public class AnnotatedSagaRepository<T> extends LockingSagaRepository<T>
Constructor and Description |
---|
AnnotatedSagaRepository(Class<T> sagaType,
SagaStore<? super T> sagaStore)
Initializes an AnnotatedSagaRepository for given
sagaType that stores sagas in the given sagaStore . |
AnnotatedSagaRepository(Class<T> sagaType,
SagaStore<? super T> sagaStore,
ResourceInjector resourceInjector)
Initializes an AnnotatedSagaRepository for given
sagaType that stores sagas in the given sagaStore . |
AnnotatedSagaRepository(Class<T> sagaType,
SagaStore<? super T> sagaStore,
ResourceInjector resourceInjector,
ParameterResolverFactory parameterResolverFactory)
Initializes an AnnotatedSagaRepository for given
sagaType that stores sagas in the given sagaStore . |
AnnotatedSagaRepository(Class<T> sagaType,
SagaStore<? super T> sagaStore,
ResourceInjector resourceInjector,
ParameterResolverFactory parameterResolverFactory,
HandlerDefinition handlerDefinition)
Initializes an AnnotatedSagaRepository for given
sagaType that stores sagas in the given sagaStore . |
AnnotatedSagaRepository(Class<T> sagaType,
SagaStore<? super T> sagaStore,
SagaModel<T> sagaModel,
ResourceInjector resourceInjector,
LockFactory lockFactory)
Initializes an AnnotatedSagaRepository for given
sagaType that stores sagas in the given sagaStore . |
Modifier and Type | Method and Description |
---|---|
protected void |
commit(AnnotatedSaga<T> saga)
Commits the given modified
saga to the underlying saga store. |
protected void |
deleteSaga(AnnotatedSaga<T> saga)
Remove the given saga as well as all known association values pointing to it from the repository.
|
AnnotatedSaga<T> |
doCreateInstance(String sagaIdentifier,
Supplier<T> sagaFactory)
Creates a new Saga instance.
|
AnnotatedSaga<T> |
doLoad(String sagaIdentifier)
Loads a known Saga instance by its unique identifier.
|
protected AnnotatedSaga<T> |
doLoadSaga(String sagaIdentifier)
Loads the saga with given
sagaIdentifier from the underlying saga store and returns it as a AnnotatedSaga . |
Set<String> |
find(AssociationValue associationValue)
Find saga instances of the given
type that have been associated with the given
associationValue . |
protected void |
storeSaga(AnnotatedSaga<T> saga)
Stores a newly created Saga instance.
|
protected Set<String> |
unsavedSagaResource(UnitOfWork<?> unitOfWork)
Returns a set of identifiers of sagas that may have changed in the context of the given
unitOfWork and
have not been saved yet. |
protected void |
updateSaga(AnnotatedSaga<T> saga)
Update a stored Saga, by replacing it with the given
saga instance. |
createInstance, load
public AnnotatedSagaRepository(Class<T> sagaType, SagaStore<? super T> sagaStore)
sagaType
that stores sagas in the given sagaStore
. The repository will use a AnnotationSagaMetaModelFactory
and NoResourceInjector
to
initialize Saga
instances after a target instance is created or loaded from the store. This repository
uses a PessimisticLockFactory
when a Saga
is loaded.sagaType
- the saga target typesagaStore
- the saga store for saving and loading of sagaspublic AnnotatedSagaRepository(Class<T> sagaType, SagaStore<? super T> sagaStore, ResourceInjector resourceInjector)
sagaType
that stores sagas in the given sagaStore
. The repository will use given resourceInjector
and AnnotationSagaMetaModelFactory
to
initialize Saga
instances after a target instance is created or loaded from the store. This repository
uses a PessimisticLockFactory
when a Saga
is loaded.sagaType
- the saga target typesagaStore
- the saga store for saving and loading of sagasresourceInjector
- the resource injector used to initialize Sagas
that delegate to the targetpublic AnnotatedSagaRepository(Class<T> sagaType, SagaStore<? super T> sagaStore, ResourceInjector resourceInjector, ParameterResolverFactory parameterResolverFactory)
sagaType
that stores sagas in the given sagaStore
. The repository will use given resourceInjector
and AnnotationSagaMetaModelFactory
to
initialize Saga
instances after a target instance is created or loaded from the store. This repository
uses a PessimisticLockFactory
when a Saga
is loaded.sagaType
- the saga target typesagaStore
- the saga store for saving and loading of sagasresourceInjector
- the resource injector used to initialize Sagas
that delegate to the targetparameterResolverFactory
- The ParameterResolverFactory instance to resolve parameter values for annotated
handlers withpublic AnnotatedSagaRepository(Class<T> sagaType, SagaStore<? super T> sagaStore, ResourceInjector resourceInjector, ParameterResolverFactory parameterResolverFactory, HandlerDefinition handlerDefinition)
sagaType
that stores sagas in the given sagaStore
. The repository will use given resourceInjector
and AnnotationSagaMetaModelFactory
to
initialize Saga
instances after a target instance is created or loaded from the store. This repository
uses a PessimisticLockFactory
when a Saga
is loaded.sagaType
- the saga target typesagaStore
- the saga store for saving and loading of sagasresourceInjector
- the resource injector used to initialize Sagas
that delegate to the
targetparameterResolverFactory
- The ParameterResolverFactory instance to resolve parameter values for annotated
handlers withhandlerDefinition
- The handler definition used to create concrete handlerspublic AnnotatedSagaRepository(Class<T> sagaType, SagaStore<? super T> sagaStore, SagaModel<T> sagaModel, ResourceInjector resourceInjector, LockFactory lockFactory)
sagaType
that stores sagas in the given sagaStore
. The repository will use the given sagaModel
and resourceInjector
to initialize
Saga
instances after a target instance is created or loaded from the store.sagaType
- the saga target typesagaStore
- the saga store for saving and loading of sagassagaModel
- the saga model used to initialize Sagas
that delegate to the targetresourceInjector
- the resource injector used to initialize Sagas
that delegate to the targetlockFactory
- lock factory used when a saga is loadedpublic AnnotatedSaga<T> doLoad(String sagaIdentifier)
LockingSagaRepository
null
in case a Saga doesn't
exists, as opposed to throwing an exception.doLoad
in class LockingSagaRepository<T>
sagaIdentifier
- The unique identifier of the Saga to loadnull
if no such saga existspublic AnnotatedSaga<T> doCreateInstance(String sagaIdentifier, Supplier<T> sagaFactory)
LockingSagaRepository
factoryMethod
.doCreateInstance
in class LockingSagaRepository<T>
sagaIdentifier
- the identifier to use for the new saga instancesagaFactory
- Used to create a new Saga delegateT
protected Set<String> unsavedSagaResource(UnitOfWork<?> unitOfWork)
unitOfWork
and
have not been saved yet.unitOfWork
- the unit of work to inspect for unsaved sagasprotected void commit(AnnotatedSaga<T> saga)
saga
to the underlying saga store. If the saga is not active anymore it will
be deleted. Otherwise the stored saga and its associations will be updated.saga
- the saga to commit to the storepublic Set<String> find(AssociationValue associationValue)
SagaRepository
type
that have been associated with the given
associationValue
.
associationValue
- The value that the returned Sagas must be associated withnull
.protected void deleteSaga(AnnotatedSaga<T> saga)
saga
- The saga instance to remove from the repositoryprotected void updateSaga(AnnotatedSaga<T> saga)
saga
instance.saga
- The saga that has been modified and needs to be updated in the storageprotected void storeSaga(AnnotatedSaga<T> saga)
saga
- The newly created Saga instance to store.protected AnnotatedSaga<T> doLoadSaga(String sagaIdentifier)
sagaIdentifier
from the underlying saga store and returns it as a AnnotatedSaga
. Resources of the saga will be injected using the ResourceInjector
configured with the
repository.sagaIdentifier
- the identifier of the saga to loadCopyright © 2010–2018. All rights reserved.