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(Serializer eventSerializer) messageMonitor(MessageMonitor<? super EventMessage<?>> messageMonitor) Sets theMessageMonitorto monitor ingestedEventMessages.snapshotFilter(SnapshotFilter snapshotFilter) Sets theSnapshotFilterused to filter snapshots when returning aggregate events.snapshotSerializer(Serializer snapshotSerializer) Sets theSerializerused to serialize and deserialize snapshots.spanFactory(EventBusSpanFactory spanFactory) Sets theEventBusSpanFactoryimplementation used for providing tracing capabilities.upcasterChain(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 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
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
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
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 MessageMonitor<? super EventMessage<?>> messageMonitor) - Parameters:
messageMonitor- AMessageMonitorto monitor ingestedEventMessages.- Returns:
- The current Builder instance, for fluent interfacing.
-
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:
AxonConfigurationException- If one field is asserted to be incorrect according to the builder's specifications.
-