Class AxonServerEventStoreFactory.Builder
- Enclosing class:
- AxonServerEventStoreFactory
AxonServerEventStoreFactory.
The following fields have sensible defaults:
- The
snapshot serializerdefaults to aXStreamSerializer. - The
event serializerdefaults to aXStreamSerializer. - The
upcaster chaindefaults to aNoOpEventUpcaster. - The
message monitordefaults to aNoOpMessageMonitor. - The
span factorydefaults to aDefaultEventBusSpanFactoryusing aNoOpSpanFactory.
AxonServerConfiguration, AxonServerConnectionManager, and SnapshotFilter are hard
requirements and as such should be provided.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbuild()Initializes anAxonServerEventStoreFactoryas specified through this builder.configuration(AxonServerConfiguration configuration) Sets theAxonServerConfigurationdescribing the servers to connect with and how to manage flow control.connectionManager(AxonServerConnectionManager connectionManager) Sets theAxonServerConnectionManagermanaging the connections to Axon Server.eventSerializer(org.axonframework.serialization.Serializer eventSerializer) Sets theSerializerused to de-/serialize theevent payloadandmeta datawith.messageMonitor(org.axonframework.monitoring.MessageMonitor<? super org.axonframework.eventhandling.EventMessage<?>> messageMonitor) Sets theMessageMonitorto monitor ingestedEventMessages.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) Sets theEventBusSpanFactoryimplementation used for providing tracing capabilities.upcasterChain(org.axonframework.serialization.upcasting.event.EventUpcaster upcasterChain) Sets theupcaster ch ainused 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
-
configuration
public AxonServerEventStoreFactory.Builder configuration(@Nonnull AxonServerConfiguration configuration) Sets theAxonServerConfigurationdescribing the servers to connect with and how to manage flow control.This object is used by the Axon Server
event store'sEventStorageEngineimplementation.- Parameters:
configuration- TheAxonServerConfigurationdescribing the servers to connect with and how to manage flow control.- Returns:
- The current Builder instance, for fluent interfacing.
-
connectionManager
public AxonServerEventStoreFactory.Builder connectionManager(@Nonnull AxonServerConnectionManager connectionManager) Sets theAxonServerConnectionManagermanaging the connections to Axon Server.This object is used by the Axon Server
event store'sEventStorageEngineimplementation.- Parameters:
connectionManager- TheAxonServerConnectionManagermanaging the connections to Axon Server.- Returns:
- The current Builder instance, for fluent interfacing.
-
snapshotSerializer
public AxonServerEventStoreFactory.Builder snapshotSerializer(@Nonnull org.axonframework.serialization.Serializer snapshotSerializer) Sets theSerializerused to serialize and deserialize snapshots.Defaults to a
XStreamSerializer.This object is used by the Axon Server
event store'sEventStorageEngineimplementation.- Parameters:
snapshotSerializer- TheSerializerused to de-/serialize snapshot events.- Returns:
- The current Builder instance, for fluent interfacing.
-
eventSerializer
public AxonServerEventStoreFactory.Builder eventSerializer(@Nonnull org.axonframework.serialization.Serializer eventSerializer) Sets theSerializerused to de-/serialize theevent payloadandmeta datawith.Defaults to a
XStreamSerializer.This object is used by the Axon Server
event store'sEventStorageEngineimplementation.- Parameters:
eventSerializer- The serializer to de-/serialize theevent payloadandmeta datawith.- Returns:
- The current Builder instance, for fluent interfacing.
-
snapshotFilter
public AxonServerEventStoreFactory.Builder snapshotFilter(@Nonnull org.axonframework.eventsourcing.snapshotting.SnapshotFilter snapshotFilter) Sets theSnapshotFilterused to filter snapshots when returning aggregate events.When not set all snapshots are used. Note that
SnapshotFilterinstances can be combined and should returntrueif they handle a snapshot they wish to ignore.This object is used by the Axon Server
event store'sEventStorageEngineimplementation.- Parameters:
snapshotFilter- TheSnapshotFilterused to filter snapshots when returning aggregate events.- Returns:
- The current Builder instance, for fluent interfacing.
-
upcasterChain
public AxonServerEventStoreFactory.Builder upcasterChain(@Nonnull org.axonframework.serialization.upcasting.event.EventUpcaster upcasterChain) Sets theupcaster ch ainused to deserialize events of older revisions.Defaults to a
NoOpEventUpcaster.This object is used by the Axon Server
event store'sEventStorageEngineimplementation.- Parameters:
upcasterChain- AnEventUpcasterused to deserialize events of older revisions.- Returns:
- The current Builder instance, for fluent interfacing.
-
messageMonitor
public AxonServerEventStoreFactory.Builder messageMonitor(@Nonnull org.axonframework.monitoring.MessageMonitor<? super org.axonframework.eventhandling.EventMessage<?>> messageMonitor) Sets theMessageMonitorto monitor ingestedEventMessages.Defaults to a
NoOpMessageMonitor.- Parameters:
messageMonitor- AMessageMonitorto monitor ingestedEventMessages.- Returns:
- The current Builder instance, for fluent interfacing.
-
spanFactory
public AxonServerEventStoreFactory.Builder spanFactory(@Nonnull org.axonframework.eventhandling.EventBusSpanFactory spanFactory) Sets theEventBusSpanFactoryimplementation used for providing tracing capabilities.Defaults to a
DefaultEventBusSpanFactoryusing aNoOpSpanFactory, providing no tracing capabilities.- Parameters:
spanFactory- TheSpanFactoryimplementation used for providing tracing capabilities.- Returns:
- The current Builder instance, for fluent interfacing.
-
build
Initializes anAxonServerEventStoreFactoryas specified through this builder.- Returns:
- an
AxonServerEventStoreFactoryas specified through this builder.
-
validate
protected void validate()Validates whether the fields contained in this Builder are set accordingly.- Throws:
org.axonframework.common.AxonConfigurationException- If one field is asserted to be incorrect according to the builder's specifications.
-