public static class MongoEventStorageEngine.Builder
extends org.axonframework.eventsourcing.eventstore.BatchingEventStorageEngine.Builder
MongoEventStorageEngine.
The following configurable fields have defaults:
Serializer defaults to XStreamSerializer.EventUpcaster defaults to an NoOpEventUpcaster.PersistenceExceptionResolver is defaulted to MongoEventStorageEngine.isDuplicateKeyException(Exception)XStreamSerializer.snapshotFilter defaults to a Predicate which returns true regardless.batchSize defaults to an integer of size 100.StorageStrategy defaults to a DocumentPerEventStorageStrategy.
The MongoTemplate is a hard requirement and as such should be provided.
| Modifier and Type | Method and Description |
|---|---|
MongoEventStorageEngine.Builder |
batchSize(int batchSize) |
MongoEventStorageEngine |
build()
Initializes a
MongoEventStorageEngine as specified through this Builder. |
MongoEventStorageEngine.Builder |
eventSerializer(org.axonframework.serialization.Serializer eventSerializer) |
MongoEventStorageEngine.Builder |
mongoTemplate(MongoTemplate template)
Sets the
MongoTemplate used to obtain the database and the collections. |
MongoEventStorageEngine.Builder |
persistenceExceptionResolver(org.axonframework.common.jdbc.PersistenceExceptionResolver persistenceExceptionResolver) |
MongoEventStorageEngine.Builder |
snapshotFilter(Predicate<? super org.axonframework.eventhandling.DomainEventData<?>> snapshotFilter)
Deprecated.
in favor of
snapshotFilter(SnapshotFilter) |
MongoEventStorageEngine.Builder |
snapshotFilter(org.axonframework.eventsourcing.snapshotting.SnapshotFilter snapshotFilter) |
MongoEventStorageEngine.Builder |
snapshotSerializer(org.axonframework.serialization.Serializer snapshotSerializer) |
MongoEventStorageEngine.Builder |
storageStrategy(StorageStrategy storageStrategy)
Sets the
StorageStrategy specifying how to store and retrieve events and snapshots from the
collections. |
MongoEventStorageEngine.Builder |
upcasterChain(org.axonframework.serialization.upcasting.event.EventUpcaster upcasterChain) |
protected void |
validate()
Validates whether the fields contained in this Builder are set accordingly.
|
public MongoEventStorageEngine.Builder snapshotSerializer(org.axonframework.serialization.Serializer snapshotSerializer)
snapshotSerializer in class org.axonframework.eventsourcing.eventstore.BatchingEventStorageEngine.Builderpublic MongoEventStorageEngine.Builder upcasterChain(org.axonframework.serialization.upcasting.event.EventUpcaster upcasterChain)
upcasterChain in class org.axonframework.eventsourcing.eventstore.BatchingEventStorageEngine.Builderpublic MongoEventStorageEngine.Builder persistenceExceptionResolver(org.axonframework.common.jdbc.PersistenceExceptionResolver persistenceExceptionResolver)
persistenceExceptionResolver in class org.axonframework.eventsourcing.eventstore.BatchingEventStorageEngine.Builderpublic MongoEventStorageEngine.Builder eventSerializer(org.axonframework.serialization.Serializer eventSerializer)
eventSerializer in class org.axonframework.eventsourcing.eventstore.BatchingEventStorageEngine.Builder@Deprecated public MongoEventStorageEngine.Builder snapshotFilter(Predicate<? super org.axonframework.eventhandling.DomainEventData<?>> snapshotFilter)
snapshotFilter(SnapshotFilter)snapshotFilter in class org.axonframework.eventsourcing.eventstore.BatchingEventStorageEngine.Builderpublic MongoEventStorageEngine.Builder snapshotFilter(org.axonframework.eventsourcing.snapshotting.SnapshotFilter snapshotFilter)
snapshotFilter in class org.axonframework.eventsourcing.eventstore.BatchingEventStorageEngine.Builderpublic MongoEventStorageEngine.Builder batchSize(int batchSize)
batchSize in class org.axonframework.eventsourcing.eventstore.BatchingEventStorageEngine.Builderpublic MongoEventStorageEngine.Builder mongoTemplate(MongoTemplate template)
MongoTemplate used to obtain the database and the collections.template - the MongoTemplate used to obtain the database and the collectionspublic MongoEventStorageEngine.Builder storageStrategy(StorageStrategy storageStrategy)
StorageStrategy specifying how to store and retrieve events and snapshots from the
collections. Defaults to a DocumentPerEventStorageStrategy, causing every event and snapshot to be
stored in a separate Mongo Document.storageStrategy - the StorageStrategy specifying how to store and retrieve events and snapshots
from the collectionspublic MongoEventStorageEngine build()
MongoEventStorageEngine as specified through this Builder.MongoEventStorageEngine as specified through this Builderprotected void validate()
throws org.axonframework.common.AxonConfigurationException
validate in class org.axonframework.eventsourcing.eventstore.BatchingEventStorageEngine.Builderorg.axonframework.common.AxonConfigurationException - if one field is asserted to be incorrect according to the Builder's
specificationsCopyright © 2010–2022. All rights reserved.