|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.axonframework.eventstore.mongo.MongoEventStore
public class MongoEventStore
Implementation of the EventStore based on a MongoDB instance or replica set. Sharding and pairing are
not explicitly supported.
| Constructor Summary | |
|---|---|
MongoEventStore(EventSerializer eventSerializer,
com.mongodb.Mongo mongo)
Constructor that accepts an EventSerializer, the MongoTemplate and a string containing the testContext. |
|
MongoEventStore(com.mongodb.Mongo mongo)
Constructor that uses the default EventSerializer. |
|
| Method Summary | |
|---|---|
void |
appendEvents(String type,
DomainEventStream events)
Append the events in the given stream to the event store. |
void |
appendSnapshotEvent(String type,
DomainEvent snapshotEvent)
Append the given snapshotEvent to the snapshot event log for the given type type. |
void |
ensureIndexes()
Make sure an index is created on the collection that stores domain events |
DomainEventStream |
readEvents(String type,
AggregateIdentifier identifier)
Read the events of the aggregate identified by the given type and identifier that allow the current aggregate state to be rebuilt. |
void |
setDatabaseName(String databaseName)
Sets the name of the database in which the event store should create the event collections. |
void |
setDomainEventsCollectionName(String domainEventsCollectionName)
Sets the name of the collection where this event store should store domain events. |
void |
setSnapshotEventsCollectionName(String snapshotEventsCollectionName)
Sets the name of the collection where this event store should store snapshot events. |
void |
visitEvents(EventVisitor visitor)
Loads all events available in the event store and calls EventVisitor.doWithEvent(org.axonframework.domain.DomainEvent)
for each event found. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public MongoEventStore(EventSerializer eventSerializer,
com.mongodb.Mongo mongo)
eventSerializer - Your own EventSerializermongo - Mongo instance to obtain the database and the collections.public MongoEventStore(com.mongodb.Mongo mongo)
mongo - Mongo instance to obtain the database and the collections.| Method Detail |
|---|
@PostConstruct public void ensureIndexes()
public void appendEvents(String type,
DomainEventStream events)
EventStorestream to the event store.
appendEvents in interface EventStoretype - The type descriptor of the object to storeevents - The event stream containing the events to store
public DomainEventStream readEvents(String type,
AggregateIdentifier identifier)
EventStore
readEvents in interface EventStoretype - The type descriptor of the object to retrieveidentifier - The unique aggregate identifier of the events to load
public void appendSnapshotEvent(String type,
DomainEvent snapshotEvent)
SnapshotEventStoresnapshotEvent to the snapshot event log for the given type type. The
sequence number of the snapshotEvent must be equal to the sequence number of the last regular domain
event that is included in the snapshot.
Note that the aggregate identifier and sequence number must be set on the DomainEvent. See DomainEvent.DomainEvent(long, org.axonframework.domain.AggregateIdentifier).
appendSnapshotEvent in interface SnapshotEventStoretype - The type of aggregate the event belongs tosnapshotEvent - The event summarizing one or more domain events for a specific aggregate.org.axonframework.domain.DomainEvent#DomainEvent(long, org.axonframework.domain.AggregateIdentifier))public void visitEvents(EventVisitor visitor)
EventStoreManagementEventVisitor.doWithEvent(org.axonframework.domain.DomainEvent)
for each event found. Events of a single aggregate are guaranteed to be ordered by their sequence number.
Implementations are encouraged, though not required, to supply events in the absolute chronological order.
Processing stops when the visitor throws an exception.
visitEvents in interface EventStoreManagementvisitor - The visitor the receives each loaded eventpublic void setDatabaseName(String databaseName)
databaseName - the name of the database where events should be storedpublic void setDomainEventsCollectionName(String domainEventsCollectionName)
snapshot events collection.
domainEventsCollectionName - The name of the collection that stores domain events.public void setSnapshotEventsCollectionName(String snapshotEventsCollectionName)
domain events collection.
snapshotEventsCollectionName - The name of the collection that stores snapshot events.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||