Interface PersistentStreamEventSourceFactory
- All Known Implementing Classes:
DefaultPersistentStreamEventSourceFactory,MultiTenantPersistentStreamEventSourceFactory
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
SubscribableEventSource that consumes a persistent stream on Axon Server.
Provides the customization point for persistent stream event source construction. The default implementation is
DefaultPersistentStreamEventSourceFactory, which builds a PersistentStreamEventSource and
additionally tracks stream names, emitting a warning when the same Axon Server stream name is used more than once.
In a Spring Boot application the default factory is registered as a @ConditionalOnMissingBean, so advanced
use cases can replace it by declaring their own bean of this type.
- Since:
- 5.2.0
- Author:
- Jakob Hatzl
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptiondefault SubscribableEventSourcebuild(String name, io.axoniq.axonserver.connector.event.PersistentStreamProperties properties, ScheduledExecutorService scheduler, int batchSize, Configuration configuration) Builds theSubscribableEventSourceconsuming the persistent stream described by the given parameters, on the given, already createdscheduler.build(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.The defaultPersistentStreamEventSourceFactory(aDefaultPersistentStreamEventSourceFactory) to be used to create theSubscribableEventSourceconsuming a persistent stream.
-
Method Details
-
build
SubscribableEventSource build(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.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.
- 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
-
build
default SubscribableEventSource build(String name, io.axoniq.axonserver.connector.event.PersistentStreamProperties properties, ScheduledExecutorService scheduler, int batchSize, Configuration configuration) Builds theSubscribableEventSourceconsuming the persistent stream described by the given parameters, on the given, already createdscheduler.Delegates to
build(String, PersistentStreamProperties, Function, int, Configuration)with a factory handing out that onescheduler.- Parameters:
name- the unique stream name on Axon Serverproperties- the persistent stream properties (segment count, sequencing policy, filter, etc.)scheduler- the scheduled executor to use for this stream's background tasksbatchSize- 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
-
defaultFactory
The defaultPersistentStreamEventSourceFactory(aDefaultPersistentStreamEventSourceFactory) to be used to create theSubscribableEventSourceconsuming a persistent stream.- Returns:
- the default
PersistentStreamEventSourceFactory
-