public interface StorageStrategy
Modifier and Type | Method and Description |
---|---|
com.mongodb.DBObject[] |
createDocuments(String type,
Serializer eventSerializer,
List<DomainEventMessage> messages)
Generates the DBObject instances that need to be stored for a commit.
|
void |
ensureIndexes(com.mongodb.DBCollection eventsCollection,
com.mongodb.DBCollection snapshotsCollection)
Ensure that the correct indexes are in place.
|
List<DomainEventMessage> |
extractEventMessages(com.mongodb.DBObject entry,
Object aggregateIdentifier,
Serializer serializer,
UpcasterChain upcasterChain,
boolean skipUnknownTypes)
Extracts the individual Event Messages from the given
entry . |
com.mongodb.DBCursor |
findEvents(com.mongodb.DBCollection collection,
MongoCriteria criteria)
Find all events that match the given
criteria in the given collection |
com.mongodb.DBCursor |
findEvents(com.mongodb.DBCollection collection,
String aggregateType,
String aggregateIdentifier,
long firstSequenceNumber)
Provides a cursor for access to all events for an aggregate with given
aggregateType and
aggregateIdentifier , with a sequence number equal or higher than the given
firstSequenceNumber . |
com.mongodb.DBCursor |
findLastSnapshot(com.mongodb.DBCollection collection,
String aggregateType,
String aggregateIdentifier)
Finds the entry containing the last snapshot event for an aggregate with given
aggregateType and
aggregateIdentifier in the given collection . |
com.mongodb.DBObject[] createDocuments(String type, Serializer eventSerializer, List<DomainEventMessage> messages)
type
- The aggregate's type identifiereventSerializer
- The serializer to serialize events withmessages
- The messages contained in this commitList<DomainEventMessage> extractEventMessages(com.mongodb.DBObject entry, Object aggregateIdentifier, Serializer serializer, UpcasterChain upcasterChain, boolean skipUnknownTypes)
entry
. The aggregateIdentifier
is passed to allow messages to contain the actual object, instead of its serialized form. The
serializer
and upcasterChain
should be used to deserialize and upcast messages before
returning them.entry
- The entry containing information of a stored commitaggregateIdentifier
- The aggregate identifier used to query eventsserializer
- The serializer to deserialize events withupcasterChain
- The upcaster chain to upcast stored events withskipUnknownTypes
- Whether unknown event types should be skippedcom.mongodb.DBCursor findEvents(com.mongodb.DBCollection collection, String aggregateType, String aggregateIdentifier, long firstSequenceNumber)
aggregateType
and
aggregateIdentifier
, with a sequence number equal or higher than the given
firstSequenceNumber
. The returned documents should be ordered chronologically (typically by using
the sequence number).
Each DBObject document returned as result of this cursor will be passed to extractEventMessages(com.mongodb.DBObject, java.lang.Object, org.axonframework.serializer.Serializer, org.axonframework.upcasting.UpcasterChain, boolean)
in order to retrieve individual DomainEventMessages.collection
- The collection toaggregateType
- The type identifier of the aggregate to queryaggregateIdentifier
- The identifier of the aggregate to queryfirstSequenceNumber
- The sequence number of the first event to returncom.mongodb.DBCursor findEvents(com.mongodb.DBCollection collection, MongoCriteria criteria)
criteria
in the given collection
collection
- The collection to search for eventscriteria
- The criteria to match against the eventscom.mongodb.DBCursor findLastSnapshot(com.mongodb.DBCollection collection, String aggregateType, String aggregateIdentifier)
aggregateType
and
aggregateIdentifier
in the given collection
. For each result returned by the Cursor,
an invocation to extractEventMessages(com.mongodb.DBObject, java.lang.Object, org.axonframework.serializer.Serializer, org.axonframework.upcasting.UpcasterChain, boolean)
will be used to extract
the actual DomainEventMessages.collection
- The collection to find the last snapshot event inaggregateType
- The type identifier of the aggregate to find a snapshot foraggregateIdentifier
- The identifier of the aggregate to find a snapshot forvoid ensureIndexes(com.mongodb.DBCollection eventsCollection, com.mongodb.DBCollection snapshotsCollection)
eventsCollection
- The collection containing the documents representing commits and events.snapshotsCollection
- The collection containing the document representing snapshotsCopyright © 2010-2014. All Rights Reserved.