Class DefaultPersistentStreamEventSourceFactory
- All Implemented Interfaces:
PersistentStreamEventSourceFactory
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 Summary
FieldsModifier and TypeFieldDescriptionstatic final PersistentStreamEventSourceFactoryDefault singleton instance for theDefaultPersistentStreamEventSourceFactory. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbuild(String name, io.axoniq.axonserver.connector.event.PersistentStreamProperties properties, Function<String, ScheduledExecutorService> schedulerFactory, int batchSize, Configuration configuration) Builds theSubscribableEventSourceconsuming the persistent stream described by the given parameters, taking theScheduledExecutorServiceinstances it needs from the givenschedulerFactory.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface io.axoniq.framework.axonserver.connector.event.PersistentStreamEventSourceFactory
build
-
Field Details
-
INSTANCE
Default singleton instance for theDefaultPersistentStreamEventSourceFactory. Use this to ensure stream name duplication warnings across all streams constructed with this.
-
-
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:PersistentStreamEventSourceFactoryBuilds theSubscribableEventSourceconsuming the persistent stream described by the given parameters, taking theScheduledExecutorServiceinstances it needs from the givenschedulerFactory.The supplied
Configurationprovides access to all registered framework components, such as theAxonServerConnectionManagerandEventConverter, 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:
buildin interfacePersistentStreamEventSourceFactory- Parameters:
name- the unique stream name on Axon Serverproperties- the persistent stream properties (segment count, sequencing policy, filter, etc.)schedulerFactory- the factory creating aScheduledExecutorServicefor the pool name given to itbatchSize- the maximum number of events to deliver per batchconfiguration- the framework configuration from which additional components can be retrieved- Returns:
- a new
SubscribableEventSourceconsuming the described persistent stream
-