Class AxonServerEventStore.Builder

java.lang.Object
org.axonframework.eventhandling.AbstractEventBus.Builder
org.axonframework.eventsourcing.eventstore.AbstractEventStore.Builder
org.axonframework.axonserver.connector.event.axon.AxonServerEventStore.Builder
Enclosing class:
AxonServerEventStore

public static class AxonServerEventStore.Builder extends org.axonframework.eventsourcing.eventstore.AbstractEventStore.Builder
Builder class to instantiate a 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.

  • Constructor Details

    • Builder

      public Builder()
  • Method Details

    • storageEngine

      public AxonServerEventStore.Builder storageEngine(org.axonframework.eventsourcing.eventstore.EventStorageEngine storageEngine)
      Overrides:
      storageEngine in class org.axonframework.eventsourcing.eventstore.AbstractEventStore.Builder
    • messageMonitor

      public AxonServerEventStore.Builder messageMonitor(@Nonnull org.axonframework.monitoring.MessageMonitor<? super org.axonframework.eventhandling.EventMessage<?>> messageMonitor)
      Overrides:
      messageMonitor in class org.axonframework.eventsourcing.eventstore.AbstractEventStore.Builder
    • spanFactory

      public AxonServerEventStore.Builder spanFactory(@Nonnull org.axonframework.tracing.SpanFactory spanFactory)
      Overrides:
      spanFactory in class org.axonframework.eventhandling.AbstractEventBus.Builder
    • spanFactory

      public AxonServerEventStore.Builder spanFactory(@Nonnull org.axonframework.eventhandling.EventBusSpanFactory spanFactory)
      Overrides:
      spanFactory in class org.axonframework.eventhandling.AbstractEventBus.Builder
    • configuration

      public AxonServerEventStore.Builder configuration(AxonServerConfiguration configuration)
      Sets the AxonServerConfiguration describing the servers to connect with and how to manage flow control.

      This object is used by the AxonServer EventStorageEngine implementation which this Builder will create if it is not provided. We suggest to use these, instead of the AbstractEventStore.storageEngine() function to set the EventStorageEngine.

      Parameters:
      configuration - the AxonServerConfiguration describing 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 the AxonServerConnectionManager managing the connections to the AxonServer platform.

      This object is used by the AxonServer EventStorageEngine implementation which this Builder will create if it is not provided. We suggest to use these, instead of the AbstractEventStore.storageEngine() function to set the EventStorageEngine.

      Parameters:
      axonServerConnectionManager - the AxonServerConnectionManager managing 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 the Serializer used to serialize and deserialize snapshots. Defaults to a XStreamSerializer.

      This object is used by the AxonServer EventStorageEngine implementation which this Builder will create if it is not provided. We suggest to use these, instead of the AbstractEventStore.storageEngine() function to set the EventStorageEngine.

      Parameters:
      snapshotSerializer - a Serializer used to serialize and deserialize snapshots
      Returns:
      the current Builder instance, for fluent interfacing
    • eventSerializer

      public AxonServerEventStore.Builder eventSerializer(org.axonframework.serialization.Serializer eventSerializer)
      Sets the Serializer used to serialize and deserialize the Event Message's payload and Meta Data with. Defaults to a XStreamSerializer.

      This object is used by the AxonServer EventStorageEngine implementation which this Builder will create if it is not provided. We suggest to use these, instead of the AbstractEventStore.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

      public AxonServerEventStore.Builder defaultContext(String 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.
      Sets the Predicate used to filter snapshots when returning aggregate events. When not set all snapshots are used.

      This object is used by the AxonServer EventStorageEngine implementation.

      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 the SnapshotFilter used to filter snapshots when returning aggregate events. When not set all snapshots are used. Note that SnapshotFilter instances can be combined and should return true if they handle a snapshot they wish to ignore.

      This object is used by the AxonServer EventStorageEngine implementation.

      Parameters:
      snapshotFilter - the SnapshotFilter to use
      Returns:
      the current Builder instance, for fluent interfacing
    • upcasterChain

      public AxonServerEventStore.Builder upcasterChain(org.axonframework.serialization.upcasting.event.EventUpcaster upcasterChain)
      Sets the EventUpcaster used to deserialize events of older revisions. Defaults to a NoOpEventUpcaster.

      This object is used by the AxonServer EventStorageEngine implementation which this Builder will create if it is not provided. We suggest to use these, instead of the AbstractEventStore.storageEngine() function to set the EventStorageEngine.

      Parameters:
      upcasterChain - an EventUpcaster used to deserialize events of older revisions
      Returns:
      the current Builder instance, for fluent interfacing
    • build

      public AxonServerEventStore build()
      Initializes a AxonServerEventStore as specified through this Builder.
      Returns:
      a AxonServerEventStore as specified through this Builder
    • validate

      protected void validate() throws org.axonframework.common.AxonConfigurationException
      Validates whether the fields contained in this Builder are set accordingly.
      Overrides:
      validate in class org.axonframework.eventsourcing.eventstore.AbstractEventStore.Builder
      Throws:
      org.axonframework.common.AxonConfigurationException - if one field is asserted to be incorrect according to the Builder's specifications