Class DefaultPersistentStreamEventSourceFactory

java.lang.Object
io.axoniq.framework.axonserver.connector.event.DefaultPersistentStreamEventSourceFactory
All Implemented Interfaces:
PersistentStreamEventSourceFactory

@Internal public class DefaultPersistentStreamEventSourceFactory extends Object implements PersistentStreamEventSourceFactory
Default implementation of PersistentStreamEventSourceFactory, building one source per Axon Server stream.

Tracks all stream names that have been used to create a source and logs a warning when the same Axon Server stream name is used more than once. Two sources sharing the same server-side stream name will join the same stream, which is typically a misconfiguration.

Marked Internal as concrete, internal implementation of the PersistentStreamEventSourceFactory.

Since:
5.2.0
Author:
Jakob Hatzl
See Also:
  • Field Details

  • Constructor Details

    • DefaultPersistentStreamEventSourceFactory

      public DefaultPersistentStreamEventSourceFactory()
  • Method Details

    • build

      public SubscribableEventSource build(String name, io.axoniq.axonserver.connector.event.PersistentStreamProperties properties, Function<String,ScheduledExecutorService> schedulerFactory, int batchSize, Configuration configuration)
      Description copied from interface: PersistentStreamEventSourceFactory
      Builds the SubscribableEventSource consuming the persistent stream described by the given parameters, taking the ScheduledExecutorService instances it needs from the given schedulerFactory.

      The supplied Configuration provides access to all registered framework components, such as the AxonServerConnectionManager and EventConverter, so implementations do not need to receive those as constructor arguments.

      A factory is handed a scheduler factory rather than a scheduler, so implementations can create pools under their control. The requested pool name is used to name the pool's threads, so the source a thread belongs to is visible in a thread dump; pass the stream name for a single stream and a name distinguishing them for several.

      Specified by:
      build in interface PersistentStreamEventSourceFactory
      Parameters:
      name - the unique stream name on Axon Server
      properties - the persistent stream properties (segment count, sequencing policy, filter, etc.)
      schedulerFactory - the factory creating a ScheduledExecutorService for the pool name given to it
      batchSize - the maximum number of events to deliver per batch
      configuration - the framework configuration from which additional components can be retrieved
      Returns:
      a new SubscribableEventSource consuming the described persistent stream