public class DocumentPerEventStorageStrategy extends AbstractMongoEventStorageStrategy
ORDER_ASC, ORDER_DESC
Constructor and Description |
---|
DocumentPerEventStorageStrategy()
Initializes a
DocumentPerEventStorageStrategy with default configuration. |
DocumentPerEventStorageStrategy(EventEntryConfiguration eventConfiguration,
Duration lookBackTime)
Initializes a
DocumentPerEventStorageStrategy with given eventConfiguration . |
Modifier and Type | Method and Description |
---|---|
protected Stream<org.bson.Document> |
createEventDocuments(List<? extends EventMessage<?>> events,
Serializer serializer)
Returns a stream of Mongo documents that represent the given batch of events.
|
protected org.bson.Document |
createSnapshotDocument(DomainEventMessage<?> snapshot,
Serializer serializer)
Returns a Mongo document for given snapshot event.
|
protected Stream<? extends DomainEventData<?>> |
extractEvents(org.bson.Document object)
Retrieves event data from the given Mongo
object . |
protected DomainEventData<?> |
extractSnapshot(org.bson.Document object)
Retrieves snapshot event data from the given Mongo
object . |
appendEvents, appendSnapshot, createTailToken, deleteSnapshots, ensureIndexes, eventConfiguration, extractHighestSequenceNumber, findDomainEvents, findLastSnapshot, findTrackedEvents, lastSequenceNumberFor
public DocumentPerEventStorageStrategy()
DocumentPerEventStorageStrategy
with default configuration.public DocumentPerEventStorageStrategy(EventEntryConfiguration eventConfiguration, Duration lookBackTime)
DocumentPerEventStorageStrategy
with given eventConfiguration
.eventConfiguration
- object that configures the naming of event entry propertieslookBackTime
- the maximum time to look back when fetching new events while tracking.protected Stream<org.bson.Document> createEventDocuments(List<? extends EventMessage<?>> events, Serializer serializer)
AbstractMongoEventStorageStrategy
events
represents events produced in the context of a single unit of work. Uses the given serializer
to
serialize event payload and metadata.createEventDocuments
in class AbstractMongoEventStorageStrategy
events
- the events to convert to Mongo documentsserializer
- the serializer to convert the events' payload and metadataprotected org.bson.Document createSnapshotDocument(DomainEventMessage<?> snapshot, Serializer serializer)
AbstractMongoEventStorageStrategy
serializer
to serialize event payload
and metadata.createSnapshotDocument
in class AbstractMongoEventStorageStrategy
snapshot
- the snapshot to convertserializer
- the to convert the snapshot's payload and metadataprotected Stream<? extends DomainEventData<?>> extractEvents(org.bson.Document object)
AbstractMongoEventStorageStrategy
object
.extractEvents
in class AbstractMongoEventStorageStrategy
object
- the object to convert to event dataprotected DomainEventData<?> extractSnapshot(org.bson.Document object)
AbstractMongoEventStorageStrategy
object
.extractSnapshot
in class AbstractMongoEventStorageStrategy
object
- the object to convert to snapshot dataCopyright © 2010–2018. All rights reserved.