public class InMemorySagaRepository extends Object implements SagaRepository
| Constructor and Description |
|---|
InMemorySagaRepository() |
| Modifier and Type | Method and Description |
|---|---|
void |
add(Saga saga)
Registers a newly created Saga with the Repository.
|
void |
commit(Saga saga)
Commits the changes made to the Saga instance.
|
Set<String> |
find(Class<? extends Saga> type,
AssociationValue associationValue)
Find saga instances of the given
type that have been associated with the given
associationValue. |
Saga |
load(String sagaIdentifier)
Loads a known Saga instance by its unique identifier.
|
int |
size()
Returns the number of Sagas currently contained in this repository.
|
public Set<String> find(Class<? extends Saga> type, AssociationValue associationValue)
SagaRepositorytype that have been associated with the given
associationValue.
Returned Sagas must be committed after processing.find in interface SagaRepositorytype - The type of Saga to returnassociationValue - The value that the returned Sagas must be associated withnull.public Saga load(String sagaIdentifier)
SagaRepositorycommitted
after processing.
Due to the concurrent nature of Sagas, it is not unlikely for a Saga to have ceased to exist after it has been
found based on associations. Therefore, a repository should return null in case a Saga doesn't
exists, as opposed to throwing an exception.load in interface SagaRepositorysagaIdentifier - The unique identifier of the Saga to loadnull if no such saga existspublic void commit(Saga saga)
SagaRepositorySaga.isActive() returns
false), the repository should delete the saga from underlying storage and remove all stored association
values associated with that Saga.
Implementations *may* (temporarily) return a cached version of the Saga, which is marked inactive.commit in interface SagaRepositorysaga - The Saga instance to commitpublic void add(Saga saga)
SagaRepositorySaga.isActive() returns
false), it is not stored.add in interface SagaRepositorysaga - The Saga instances to add.public int size()
Copyright © 2010-2014. All Rights Reserved.