public abstract static class BatchingEventStorageEngine.Builder extends AbstractEventStorageEngine.Builder
BatchingEventStorageEngine
.
The EventUpcaster
defaults to a NoOpEventUpcaster
, the snapshotFilter
defaults to a
SnapshotFilter.allowAll()
instance and the batchSize
is defaulted to an integer of size 100
.
The event and snapshot Serializer
are hard requirements and as such should be provided.
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 MetaData with. |
BatchingEventStorageEngine.Builder |
finalAggregateBatchPredicate(Predicate<List<? extends DomainEventData<?>>> finalAggregateBatchPredicate)
Defines the predicate to use to recognize the terminal batch when reading an event stream for an aggregate.
|
BatchingEventStorageEngine.Builder |
persistenceExceptionResolver(PersistenceExceptionResolver persistenceExceptionResolver)
Sets the
PersistenceExceptionResolver used to detect concurrency exceptions from the backing
database. |
BatchingEventStorageEngine.Builder |
snapshotFilter(Predicate<? super DomainEventData<?>> snapshotFilter)
Deprecated.
in favor of
snapshotFilter(SnapshotFilter) |
BatchingEventStorageEngine.Builder |
snapshotFilter(SnapshotFilter 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.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 MetaData
with.eventSerializer
in class AbstractEventStorageEngine.Builder
eventSerializer
- The serializer to serialize the Event Message's payload and MetaData
withpublic BatchingEventStorageEngine.Builder finalAggregateBatchPredicate(Predicate<List<? extends DomainEventData<?>>> finalAggregateBatchPredicate)
finalAggregateBatchPredicate
- The predicate that indicates whether a given batch is to be considered
the final batch of an event stream.@Deprecated public BatchingEventStorageEngine.Builder snapshotFilter(Predicate<? super DomainEventData<?>> snapshotFilter)
snapshotFilter(SnapshotFilter)
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 snapshotFilter(SnapshotFilter 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 SnapshotFilter.allowAll()
.
Note that SnapshotFilter
instances can be combined and should return true
if they handle a
snapshot they wish to ignore.
snapshotFilter
in class AbstractEventStorageEngine.Builder
snapshotFilter
- a SnapshotFilter
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–2024. All rights reserved.