Class SagaEntry<T>
java.lang.Object
org.axonframework.extensions.mongo.eventhandling.saga.repository.SagaEntry<T>
- Type Parameters:
T- the type of saga stored in this entry
Java representation of sagas stored in a mongo instance
- Since:
- 2.0
- Author:
- Jettro Coenradie
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionorg.bson.DocumentReturns the Mongo Document representing the Saga provided in this entry.Get a set of all the Saga's associations.Returns the Saga instance stored in this entry, converted into the givensagaType.Get the identifier of this Saga.static org.bson.conversions.BsonqueryByIdentifier(String identifier) Returns the Mongo Query to find a Saga based on its identifier.
-
Constructor Details
-
SagaEntry
public SagaEntry(String identifier, T saga, Set<AssociationValue> associationValues, Converter converter) Constructs a new SagaEntry for the givensaga. The given saga must be convertible to a byte array. The provided saga is not modified by this operation.- Parameters:
identifier- The identifier of the sagasaga- The saga to storeassociationValues- The associations of the sagaconverter- The conversion mechanism to convert the Saga to a byte stream
-
SagaEntry
public SagaEntry(org.bson.Document dbSaga) Initializes a Saga entry using a Document containing the Mongo Document- Parameters:
dbSaga- The mongo Document containing the converted saga
-
-
Method Details
-
getSaga
Returns the Saga instance stored in this entry, converted into the givensagaType.Takes the target type because a
Converterneeds one, where theSerializerthis replaces resolved it from the type name stored alongside the saga. That name is still written, so a reader outside this module can tell what a document holds, but conversion goes by what the caller asked for.- Parameters:
converter- The converter to convert the Saga withsagaType- The class to convert the stored saga into- Returns:
- the Saga instance stored in this entry
-
getSagaId
Get the identifier of this Saga.- Returns:
- the saga identifier
-
getAssociationValues
Get a set of all the Saga's associations.- Returns:
- association values of this Saga
-
asDocument
public org.bson.Document asDocument()Returns the Mongo Document representing the Saga provided in this entry.- Returns:
- the Mongo Document representing the Saga provided in this entry
-
queryByIdentifier
Returns the Mongo Query to find a Saga based on its identifier.- Parameters:
identifier- The identifier of the saga to find- Returns:
- the Query (as Bson) to find a Saga in a Mongo Database
-