Class PersistentStreamAutoConfiguration
java.lang.Object
io.axoniq.framework.springboot.autoconfig.PersistentStreamAutoConfiguration
@AutoConfiguration(after={AxonServerAutoConfiguration.class,DeadLetterQueueConfiguration.class},
before=EventProcessingAutoConfiguration.class)
public class PersistentStreamAutoConfiguration
extends Object
Spring Boot autoconfiguration that defines the required infrastructure for persistent streams by creating
a
PersistentStreamScheduledExecutorBuilder, a PersistentStreamEventSourceFactory and a named
PersistentStreamEventSource bean for each entry under axon.axonserver.persistent-streams using
the PersistentStreamConfigurationEnhancer configuration enhancer.- Since:
- 5.2.0
- Author:
- Jakob Hatzl
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionpersistentStreamConfigurationEnhancer(org.springframework.beans.factory.ObjectProvider<AxonServerConfiguration> axonServerConfigProvider, PersistentStreamScheduledExecutorBuilder schedulerBuilder, PersistentStreamEventSourceFactory factory) Creates aPersistentStreamConfigurationEnhancerthat registers aPersistentStreamEventSourcecomponent for each entry underaxon.axonserver.persistent-streams.Creates the defaultPersistentStreamEventSourceFactoryif no custom one is present.Creates the defaultPersistentStreamScheduledExecutorBuilderif no custom one is present.
-
Constructor Details
-
PersistentStreamAutoConfiguration
public PersistentStreamAutoConfiguration()
-
-
Method Details
-
persistentStreamScheduledExecutorBuilder
@Bean @ConditionalOnMissingBean @ConditionalOnProperty(name="axon.axonserver.event-store.enabled", matchIfMissing=true) public PersistentStreamScheduledExecutorBuilder persistentStreamScheduledExecutorBuilder()Creates the defaultPersistentStreamScheduledExecutorBuilderif no custom one is present.- Returns:
- the default
PersistentStreamScheduledExecutorBuilder
-
persistentStreamEventSourceFactory
@Bean @ConditionalOnMissingBean @ConditionalOnProperty(name="axon.axonserver.event-store.enabled", matchIfMissing=true) public PersistentStreamEventSourceFactory persistentStreamEventSourceFactory()Creates the defaultPersistentStreamEventSourceFactoryif no custom one is present.The default implementation is
DefaultPersistentStreamEventSourceFactory. Declare a bean of typePersistentStreamEventSourceFactoryto replace this with custom construction logic.- Returns:
- the default
PersistentStreamEventSourceFactory
-
persistentStreamConfigurationEnhancer
@Bean @ConditionalOnMissingBean @ConditionalOnProperty(name="axon.axonserver.event-store.enabled", matchIfMissing=true) public PersistentStreamConfigurationEnhancer persistentStreamConfigurationEnhancer(org.springframework.beans.factory.ObjectProvider<AxonServerConfiguration> axonServerConfigProvider, PersistentStreamScheduledExecutorBuilder schedulerBuilder, PersistentStreamEventSourceFactory factory) Creates aPersistentStreamConfigurationEnhancerthat registers aPersistentStreamEventSourcecomponent for each entry underaxon.axonserver.persistent-streams.By being a
ConfigurationEnhancereach component is registered under the map key as its name, making it retrievable viaconfiguration.getOptionalComponent(SubscribableEventSource.class, "<stream-name>"). TheSpringComponentRegistrypromotes these components to named Spring beans, which enables wiring throughaxon.eventhandling.processors.<name>.source=<stream-name>.The returned bean also implements
DisposableBeanto shut down all createdScheduledExecutorServiceinstances when the Spring application context closes.- Parameters:
axonServerConfigProvider- provider for the Axon Server configuration containing persistent stream settings; resolved lazily duringPersistentStreamConfigurationEnhancer.enhance(org.axonframework.common.configuration.ComponentRegistry)to avoid Spring lifecycle ordering issuesschedulerBuilder- the builder used to create a per-streamScheduledExecutorServicefactory- the factory used to construct eachPersistentStreamEventSource- Returns:
- a
PersistentStreamConfigurationEnhancerthat registersPersistentStreamEventSourcecomponents
-