Class AxonServerEventStore.Builder
- Enclosing class:
- AxonServerEventStore
AxonServerEventStore.
The main goal of this Builder is to instantiate an AxonServer specific EventStorageEngine. The properties
which may be provided through this Builder are thus all used to end up with that EventStorageEngine
implementation. An EventStorageEngine may be provided directly however, although we encourage the usage of the
configuration and axonServerConnectionManager functions to let it be created.
The EventUpcaster is defaulted to a NoOpEventUpcaster. The MessageMonitor is defaulted to
an NoOpMessageMonitor and the EventBusSpanFactory defaults to a
DefaultEventBusSpanFactory backed by a NoOpSpanFactory.
The event and snapshot Serializer, AxonServerConfiguration and
AxonServerConnectionManager are hard requirements if no EventStorageEngine is provided directly.
-
Field Summary
Fields inherited from class org.axonframework.eventsourcing.eventstore.AbstractEventStore.Builder
storageEngine -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbuild()Initializes aAxonServerEventStoreas specified through this Builder.configuration(AxonServerConfiguration configuration) Sets theAxonServerConfigurationdescribing the servers to connect with and how to manage flow control.defaultContext(String defaultContext) Sets the default context for this event store to connect to.eventSerializer(org.axonframework.serialization.Serializer eventSerializer) Sets theSerializerused to serialize and deserialize the Event Message's payload and Meta Data with.messageMonitor(org.axonframework.monitoring.MessageMonitor<? super org.axonframework.eventhandling.EventMessage<?>> messageMonitor) platformConnectionManager(AxonServerConnectionManager axonServerConnectionManager) Sets theAxonServerConnectionManagermanaging the connections to the AxonServer platform.snapshotFilter(Predicate<? super org.axonframework.eventhandling.DomainEventData<?>> snapshotFilter) Deprecated.snapshotFilter(org.axonframework.eventsourcing.snapshotting.SnapshotFilter snapshotFilter) Sets theSnapshotFilterused to filter snapshots when returning aggregate events.snapshotSerializer(org.axonframework.serialization.Serializer snapshotSerializer) Sets theSerializerused to serialize and deserialize snapshots.spanFactory(org.axonframework.eventhandling.EventBusSpanFactory spanFactory) spanFactory(org.axonframework.tracing.SpanFactory spanFactory) storageEngine(org.axonframework.eventsourcing.eventstore.EventStorageEngine storageEngine) upcasterChain(org.axonframework.serialization.upcasting.event.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
-
storageEngine
public AxonServerEventStore.Builder storageEngine(org.axonframework.eventsourcing.eventstore.EventStorageEngine storageEngine) - Overrides:
storageEnginein classorg.axonframework.eventsourcing.eventstore.AbstractEventStore.Builder
-
messageMonitor
public AxonServerEventStore.Builder messageMonitor(@Nonnull org.axonframework.monitoring.MessageMonitor<? super org.axonframework.eventhandling.EventMessage<?>> messageMonitor) - Overrides:
messageMonitorin classorg.axonframework.eventsourcing.eventstore.AbstractEventStore.Builder
-
spanFactory
public AxonServerEventStore.Builder spanFactory(@Nonnull org.axonframework.tracing.SpanFactory spanFactory) - Overrides:
spanFactoryin classorg.axonframework.eventhandling.AbstractEventBus.Builder
-
spanFactory
public AxonServerEventStore.Builder spanFactory(@Nonnull org.axonframework.eventhandling.EventBusSpanFactory spanFactory) - Overrides:
spanFactoryin classorg.axonframework.eventhandling.AbstractEventBus.Builder
-
configuration
Sets theAxonServerConfigurationdescribing the servers to connect with and how to manage flow control.This object is used by the AxonServer
EventStorageEngineimplementation which this Builder will create if it is not provided. We suggest to use these, instead of theAbstractEventStore.storageEngine()function to set the EventStorageEngine.- Parameters:
configuration- theAxonServerConfigurationdescribing the servers to connect with and how to manage flow control- Returns:
- the current Builder instance, for fluent interfacing
-
platformConnectionManager
public AxonServerEventStore.Builder platformConnectionManager(AxonServerConnectionManager axonServerConnectionManager) Sets theAxonServerConnectionManagermanaging the connections to the AxonServer platform.This object is used by the AxonServer
EventStorageEngineimplementation which this Builder will create if it is not provided. We suggest to use these, instead of theAbstractEventStore.storageEngine()function to set the EventStorageEngine.- Parameters:
axonServerConnectionManager- theAxonServerConnectionManagermanaging the connections to the AxonServer platform- Returns:
- the current Builder instance, for fluent interfacing
-
snapshotSerializer
public AxonServerEventStore.Builder snapshotSerializer(org.axonframework.serialization.Serializer snapshotSerializer) Sets theSerializerused to serialize and deserialize snapshots. Defaults to aXStreamSerializer.This object is used by the AxonServer
EventStorageEngineimplementation which this Builder will create if it is not provided. We suggest to use these, instead of theAbstractEventStore.storageEngine()function to set the EventStorageEngine.- Parameters:
snapshotSerializer- aSerializerused to serialize and deserialize snapshots- Returns:
- the current Builder instance, for fluent interfacing
-
eventSerializer
public AxonServerEventStore.Builder eventSerializer(org.axonframework.serialization.Serializer eventSerializer) Sets theSerializerused to serialize and deserialize the Event Message's payload and Meta Data with. Defaults to aXStreamSerializer.This object is used by the AxonServer
EventStorageEngineimplementation which this Builder will create if it is not provided. We suggest to use these, instead of theAbstractEventStore.storageEngine()function to set the EventStorageEngine.- Parameters:
eventSerializer- The serializer to serialize the Event Message's payload and Meta Data with- Returns:
- the current Builder instance, for fluent interfacing
-
defaultContext
Sets the default context for this event store to connect to.- Parameters:
defaultContext- for this event store to connect to.- Returns:
- the current Builder instance, for fluent interfacing
-
snapshotFilter
@Deprecated public AxonServerEventStore.Builder snapshotFilter(Predicate<? super org.axonframework.eventhandling.DomainEventData<?>> snapshotFilter) Deprecated.in favor ofsnapshotFilter(SnapshotFilter)Sets thePredicateused to filter snapshots when returning aggregate events. When not set all snapshots are used.This object is used by the AxonServer
EventStorageEngineimplementation.- Parameters:
snapshotFilter- The snapshot filter predicate- Returns:
- the current Builder instance, for fluent interfacing
-
snapshotFilter
public AxonServerEventStore.Builder snapshotFilter(org.axonframework.eventsourcing.snapshotting.SnapshotFilter snapshotFilter) Sets theSnapshotFilterused to filter snapshots when returning aggregate events. When not set all snapshots are used. Note thatSnapshotFilterinstances can be combined and should returntrueif they handle a snapshot they wish to ignore.This object is used by the AxonServer
EventStorageEngineimplementation.- Parameters:
snapshotFilter- theSnapshotFilterto use- Returns:
- the current Builder instance, for fluent interfacing
-
upcasterChain
public AxonServerEventStore.Builder upcasterChain(org.axonframework.serialization.upcasting.event.EventUpcaster upcasterChain) Sets theEventUpcasterused to deserialize events of older revisions. Defaults to aNoOpEventUpcaster.This object is used by the AxonServer
EventStorageEngineimplementation which this Builder will create if it is not provided. We suggest to use these, instead of theAbstractEventStore.storageEngine()function to set the EventStorageEngine.- Parameters:
upcasterChain- anEventUpcasterused to deserialize events of older revisions- Returns:
- the current Builder instance, for fluent interfacing
-
build
Initializes aAxonServerEventStoreas specified through this Builder.- Returns:
- a
AxonServerEventStoreas specified through this Builder
-
validate
protected void validate() throws org.axonframework.common.AxonConfigurationExceptionValidates whether the fields contained in this Builder are set accordingly.- Overrides:
validatein classorg.axonframework.eventsourcing.eventstore.AbstractEventStore.Builder- Throws:
org.axonframework.common.AxonConfigurationException- if one field is asserted to be incorrect according to the Builder's specifications
-
snapshotFilter(SnapshotFilter)