public abstract static class BatchingEventStorageEngine.Builder extends AbstractEventStorageEngine.Builder
BatchingEventStorageEngine
.
This implementation inherits the following defaults: The Serializer
used for snapshots is defaulted to a
XStreamSerializer
, the EventUpcaster
defaults to a
NoOpEventUpcaster
, the Serializer used for events is
also defaulted to a XStreamSerializer and the snapshotFilter
defaults to a Predicate
which
returns true
regardless.
The batchSize
in this Builder implementation is defaulted to an integer of size 100
.
upcasterChain
Constructor and Description |
---|
Builder() |
Modifier and Type | Method and Description |
---|---|
BatchingEventStorageEngine.Builder |
batchSize(int batchSize)
Sets the
batchSize specifying the number of events that should be read at each database access. |
BatchingEventStorageEngine.Builder |
eventSerializer(Serializer eventSerializer)
Sets the
Serializer used to serialize and deserialize the Event Message's payload and Meta Data with. |
BatchingEventStorageEngine.Builder |
persistenceExceptionResolver(PersistenceExceptionResolver persistenceExceptionResolver)
Sets the
PersistenceExceptionResolver used to detect concurrency exceptions from the backing
database. |
BatchingEventStorageEngine.Builder |
snapshotFilter(Predicate<? super DomainEventData<?>> snapshotFilter)
Sets the
snapshotFilter deciding whether to take a snapshot into account. |
BatchingEventStorageEngine.Builder |
snapshotSerializer(Serializer snapshotSerializer)
Sets the
Serializer used to serialize and deserialize snapshots. |
BatchingEventStorageEngine.Builder |
upcasterChain(EventUpcaster upcasterChain)
Sets the
EventUpcaster used to deserialize events of older revisions. |
protected void |
validate()
Validates whether the fields contained in this Builder are set accordingly.
|
public BatchingEventStorageEngine.Builder snapshotSerializer(Serializer snapshotSerializer)
AbstractEventStorageEngine.Builder
Serializer
used to serialize and deserialize snapshots. Defaults to a XStreamSerializer
.snapshotSerializer
in class AbstractEventStorageEngine.Builder
snapshotSerializer
- a Serializer
used to serialize and deserialize snapshotspublic BatchingEventStorageEngine.Builder upcasterChain(EventUpcaster upcasterChain)
AbstractEventStorageEngine.Builder
EventUpcaster
used to deserialize events of older revisions. Defaults to a NoOpEventUpcaster
.upcasterChain
in class AbstractEventStorageEngine.Builder
upcasterChain
- an EventUpcaster
used to deserialize events of older revisionspublic BatchingEventStorageEngine.Builder persistenceExceptionResolver(PersistenceExceptionResolver persistenceExceptionResolver)
AbstractEventStorageEngine.Builder
PersistenceExceptionResolver
used to detect concurrency exceptions from the backing
database. If the persistenceExceptionResolver
is not specified, persistence exceptions are not
explicitly resolved.persistenceExceptionResolver
in class AbstractEventStorageEngine.Builder
persistenceExceptionResolver
- the PersistenceExceptionResolver
used to detect concurrency
exceptions from the backing databasepublic BatchingEventStorageEngine.Builder eventSerializer(Serializer eventSerializer)
AbstractEventStorageEngine.Builder
Serializer
used to serialize and deserialize the Event Message's payload and Meta Data with.
Defaults to a XStreamSerializer
.eventSerializer
in class AbstractEventStorageEngine.Builder
eventSerializer
- The serializer to serialize the Event Message's payload and Meta Data withpublic BatchingEventStorageEngine.Builder snapshotFilter(Predicate<? super DomainEventData<?>> snapshotFilter)
AbstractEventStorageEngine.Builder
snapshotFilter
deciding whether to take a snapshot into account. Can be set to filter out
specific snapshot revisions which should not be applied. Defaults to a Predicate
which returns true
regardless.snapshotFilter
in class AbstractEventStorageEngine.Builder
snapshotFilter
- a Predicate
which decides whether to take a snapshot into accountpublic BatchingEventStorageEngine.Builder batchSize(int batchSize)
batchSize
specifying the number of events that should be read at each database access. When
more than this number of events must be read to rebuild an aggregate's state, the events are read in batches
of this size. Defaults to an integer of 100
.
Tip: if you use a snapshotter, make sure to choose snapshot trigger and batch size such that a single batch will generally retrieve all events required to rebuild an aggregate's state.
batchSize
- an int
specifying the number of events that should be read at each database accessprotected void validate() throws AxonConfigurationException
validate
in class AbstractEventStorageEngine.Builder
AxonConfigurationException
- if one field is asserted to be incorrect according to the Builder's
specificationsCopyright © 2010–2020. All rights reserved.