|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.axonframework.saga.repository.AbstractSagaRepository
org.axonframework.mongo3.saga.repository.MongoSagaRepository
public class MongoSagaRepository
Implementations of the SagaRepository that stores Sagas and their associations in a Mongo Database. Each Saga and its associations is stored as a single document.
| Constructor Summary | |
|---|---|
MongoSagaRepository(MongoTemplate mongoTemplate)
Initializes the Repository, using given mongoTemplate to access the collections containing the
stored Saga instances. |
|
| Method Summary | |
|---|---|
protected void |
deleteSaga(Saga saga)
Remove the given saga as well as all known association values pointing to it from the repository. |
protected Set<String> |
findAssociatedSagaIdentifiers(Class<? extends Saga> type,
AssociationValue associationValue)
Finds the identifiers of the sagas of given type associated with the given
associationValue. |
Saga |
load(String sagaIdentifier)
Loads a known Saga instance by its unique identifier. |
protected void |
removeAssociationValue(AssociationValue associationValue,
String sagaType,
String sagaIdentifier)
Removes the association value that has been associated with Saga, identified with the given sagaIdentifier. |
void |
setResourceInjector(ResourceInjector resourceInjector)
Sets the ResourceInjector to use to inject Saga instances with any (temporary) resources they might need. |
void |
setSerializer(Serializer serializer)
Provide the serializer to use if the default JavaSagaSerializer is not the best solution. |
protected void |
storeAssociationValue(AssociationValue associationValue,
String sagaType,
String sagaIdentifier)
Store the given associationValue, which has been associated with given sagaIdentifier. |
protected void |
storeSaga(Saga saga)
Stores a newly created Saga instance. |
protected String |
typeOf(Class<? extends Saga> sagaClass)
Returns the type identifier to use for the given sagaClass. |
protected void |
updateSaga(Saga saga)
Update a stored Saga, by replacing it with the given saga instance. |
| Methods inherited from class org.axonframework.saga.repository.AbstractSagaRepository |
|---|
add, commit, find |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public MongoSagaRepository(MongoTemplate mongoTemplate)
mongoTemplate to access the collections containing the
stored Saga instances.
mongoTemplate - the template providing access to the collections| Method Detail |
|---|
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.
sagaIdentifier - The unique identifier of the Saga to load
null if no such saga exists
protected Set<String> findAssociatedSagaIdentifiers(Class<? extends Saga> type,
AssociationValue associationValue)
AbstractSagaRepositorytype associated with the given
associationValue.
findAssociatedSagaIdentifiers in class AbstractSagaRepositorytype - The type of saga to find identifiers forassociationValue - The value the saga must be associated with
associationValueprotected String typeOf(Class<? extends Saga> sagaClass)
AbstractSagaRepositorysagaClass. This information is typically provided
by the Serializer, if the repository stores serialized instances.
typeOf in class AbstractSagaRepositorysagaClass - The type of saga to get the type identifier for.
protected void deleteSaga(Saga saga)
AbstractSagaRepository
deleteSaga in class AbstractSagaRepositorysaga - The saga instance to remove from the repositoryprotected void updateSaga(Saga saga)
AbstractSagaRepositorysaga instance.
updateSaga in class AbstractSagaRepositorysaga - The saga that has been modified and needs to be updated in the storageprotected void storeSaga(Saga saga)
AbstractSagaRepository
storeSaga in class AbstractSagaRepositorysaga - The newly created Saga instance to store.
protected void storeAssociationValue(AssociationValue associationValue,
String sagaType,
String sagaIdentifier)
AbstractSagaRepositoryassociationValue, which has been associated with given sagaIdentifier.
storeAssociationValue in class AbstractSagaRepositoryassociationValue - The association value to storesagaType - Type type of saga the association value belongs tosagaIdentifier - The saga related to the association value
protected void removeAssociationValue(AssociationValue associationValue,
String sagaType,
String sagaIdentifier)
AbstractSagaRepositorysagaIdentifier.
removeAssociationValue in class AbstractSagaRepositoryassociationValue - The value to remove as association value for the given sagasagaType - The type of the Saga to remove the association fromsagaIdentifier - The identifier of the Saga to remove the association frompublic void setSerializer(Serializer serializer)
serializer - SagaSerializer to use for sag serialization.public void setResourceInjector(ResourceInjector resourceInjector)
resourceInjector - The resource injector
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||