public class MongoEventStore extends Object implements SnapshotEventStore, EventStoreManagement
Implementation of the EventStore based on a MongoDB instance or replica set. Sharding and pairing are
not explicitly supported.
This event store implementation needs a serializer as well as a SagaStoreCollections to interact with the
mongo database.
| Constructor and Description |
|---|
MongoEventStore(EventStoreCollections mongo)
Constructor that uses the default Serializer.
|
MongoEventStore(Serializer<? super DomainEvent> eventSerializer,
EventStoreCollections mongo)
Constructor that accepts a Serializer, the SagaStoreCollections and a string containing the testContext.
|
| Modifier and Type | Method and Description |
|---|---|
void |
appendEvents(String type,
DomainEventStream events) |
void |
appendSnapshotEvent(String type,
DomainEvent snapshotEvent) |
void |
ensureIndexes()
Make sure an index is created on the collection that stores domain events.
|
DomainEventStream |
readEvents(String type,
AggregateIdentifier identifier) |
void |
visitEvents(EventVisitor visitor) |
public MongoEventStore(Serializer<? super DomainEvent> eventSerializer, EventStoreCollections mongo)
eventSerializer - Your own Serializermongo - Mongo instance to obtain the database and the collections.public MongoEventStore(EventStoreCollections mongo)
mongo - SagaStoreCollections instance to obtain the database and the collections.@PostConstruct public void ensureIndexes()
public void appendEvents(String type, DomainEventStream events)
appendEvents in interface EventStorepublic DomainEventStream readEvents(String type, AggregateIdentifier identifier)
readEvents in interface EventStorepublic void appendSnapshotEvent(String type, DomainEvent snapshotEvent)
appendSnapshotEvent in interface SnapshotEventStorepublic void visitEvents(EventVisitor visitor)
visitEvents in interface EventStoreManagementCopyright © 2012. All Rights Reserved.