Class BatchingEventStorageEngine.Builder
java.lang.Object
org.axonframework.eventsourcing.eventstore.AbstractEventStorageEngine.Builder
org.axonframework.eventsourcing.eventstore.BatchingEventStorageEngine.Builder
- Direct Known Subclasses:
JdbcEventStorageEngine.Builder,JpaEventStorageEngine.Builder,JpaEventStorageEngine.Builder
- Enclosing class:
BatchingEventStorageEngine
public abstract static class BatchingEventStorageEngine.Builder
extends AbstractEventStorageEngine.Builder
Abstract Builder class to instantiate a
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.
-
Field Summary
Fields inherited from class org.axonframework.eventsourcing.eventstore.AbstractEventStorageEngine.Builder
upcasterChain -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbatchSize(int batchSize) Sets thebatchSizespecifying the number of events that should be read at each database access.eventSerializer(Serializer eventSerializer) Sets theSerializerused to serialize and deserialize the Event Message's payload andMetaDatawith.finalAggregateBatchPredicate(Predicate<List<? extends DomainEventData<?>>> finalAggregateBatchPredicate) Defines the predicate to use to recognize the terminal batch when reading an event stream for an aggregate.persistenceExceptionResolver(PersistenceExceptionResolver persistenceExceptionResolver) Sets thePersistenceExceptionResolverused to detect concurrency exceptions from the backing database.snapshotFilter(Predicate<? super DomainEventData<?>> snapshotFilter) Deprecated.snapshotFilter(SnapshotFilter snapshotFilter) Sets thesnapshotFilterdeciding whether to take a snapshot into account.snapshotSerializer(Serializer snapshotSerializer) Sets theSerializerused to serialize and deserialize snapshots.upcasterChain(EventUpcaster upcasterChain) Sets theEventUpcasterused to deserialize events of older revisions.protected voidvalidate()Validates whether the fields contained in this Builder are set accordingly.
-
Constructor Details
-
Builder
public Builder()
-
-
Method Details
-
snapshotSerializer
Description copied from class:AbstractEventStorageEngine.BuilderSets theSerializerused to serialize and deserialize snapshots.- Overrides:
snapshotSerializerin classAbstractEventStorageEngine.Builder- Parameters:
snapshotSerializer- aSerializerused to serialize and deserialize snapshots- Returns:
- the current Builder instance, for fluent interfacing
-
upcasterChain
Description copied from class:AbstractEventStorageEngine.BuilderSets theEventUpcasterused to deserialize events of older revisions. Defaults to aNoOpEventUpcaster.- Overrides:
upcasterChainin classAbstractEventStorageEngine.Builder- Parameters:
upcasterChain- anEventUpcasterused to deserialize events of older revisions- Returns:
- the current Builder instance, for fluent interfacing
-
persistenceExceptionResolver
public BatchingEventStorageEngine.Builder persistenceExceptionResolver(PersistenceExceptionResolver persistenceExceptionResolver) Description copied from class:AbstractEventStorageEngine.BuilderSets thePersistenceExceptionResolverused to detect concurrency exceptions from the backing database. If thepersistenceExceptionResolveris not specified, persistence exceptions are not explicitly resolved.- Overrides:
persistenceExceptionResolverin classAbstractEventStorageEngine.Builder- Parameters:
persistenceExceptionResolver- thePersistenceExceptionResolverused to detect concurrency exceptions from the backing database- Returns:
- the current Builder instance, for fluent interfacing
-
eventSerializer
Description copied from class:AbstractEventStorageEngine.BuilderSets theSerializerused to serialize and deserialize the Event Message's payload andMetaDatawith.- Overrides:
eventSerializerin classAbstractEventStorageEngine.Builder- Parameters:
eventSerializer- The serializer to serialize the Event Message's payload andMetaDatawith- Returns:
- the current Builder instance, for fluent interfacing
-
finalAggregateBatchPredicate
public 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. The default behavior is implementation-specific.- Parameters:
finalAggregateBatchPredicate- The predicate that indicates whether a given batch is to be considered the final batch of an event stream.- Returns:
- the current Builder instance, for fluent interfacing
-
snapshotFilter
@Deprecated public BatchingEventStorageEngine.Builder snapshotFilter(Predicate<? super DomainEventData<?>> snapshotFilter) Deprecated.in favor ofsnapshotFilter(SnapshotFilter)Sets thesnapshotFilterdeciding whether to take a snapshot into account. Can be set to filter out specific snapshot revisions which should not be applied. Defaults to aPredicatewhich returnstrueregardless.- Overrides:
snapshotFilterin classAbstractEventStorageEngine.Builder- Parameters:
snapshotFilter- aPredicatewhich decides whether to take a snapshot into account- Returns:
- the current Builder instance, for fluent interfacing
-
snapshotFilter
Description copied from class:AbstractEventStorageEngine.BuilderSets thesnapshotFilterdeciding whether to take a snapshot into account. Can be set to filter out specific snapshot revisions which should not be applied. Defaults toSnapshotFilter.allowAll().Note that
SnapshotFilterinstances can be combined and should returntrueif they handle a snapshot they wish to ignore.- Overrides:
snapshotFilterin classAbstractEventStorageEngine.Builder- Parameters:
snapshotFilter- aSnapshotFilterwhich decides whether to take a snapshot into account- Returns:
- the current Builder instance, for fluent interfacing
-
batchSize
Sets thebatchSizespecifying 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 of100.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.
- Parameters:
batchSize- anintspecifying the number of events that should be read at each database access- Returns:
- the current Builder instance, for fluent interfacing
-
validate
Validates whether the fields contained in this Builder are set accordingly.- Overrides:
validatein classAbstractEventStorageEngine.Builder- Throws:
AxonConfigurationException- if one field is asserted to be incorrect according to the Builder's specifications
-
snapshotFilter(SnapshotFilter)