Class PersistentStreamConfigurationEnhancer
- All Implemented Interfaces:
ConfigurationEnhancer,org.springframework.beans.factory.DisposableBean
ConfigurationEnhancer that registers a SubscribableEventSource component consuming a persistent
stream for each entry in AxonServerConfiguration.getPersistentStreams().
Each map key of the AxonServerConfiguration.PersistentStreamSettings becomes the component name (and thus the
Spring bean name after being exposed by the
SpringComponentRegistry).
The resolved Axon Server stream name defaults to the map key but can be overridden via
AxonServerConfiguration.PersistentStreamSettings.getName().
The resulting beans can be referenced by subscribing event processors through
axon.eventhandling.processors.<processor-name>.source=<stream-name>.
Example configuration:
axon:
axonserver:
persistent-streams:
myStream:
initial-segment-count: 4
sequencing-policy: SequentialPerAggregatePolicy
initial-position: TAIL
batch-size: 10
axon:
eventhandling:
processors:
MyProjectionGroup:
source: myStream
Actual construction of each source is delegated to a PersistentStreamEventSourceFactory to allow
customization if needed. The default factory builds a PersistentStreamEventSource.
The PersistentStreamConfigurationEnhancer also implements DisposableBean and keeps a reference of every
ScheduledExecutorService a source asked it for, to shut them down again when the Spring application context
closes.
Marked Internal because instances are created by PersistentStreamAutoConfiguration and should not be
constructed directly in application code.
- Since:
- 5.2.0
- Author:
- Jakob Hatzl
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionPersistentStreamConfigurationEnhancer(org.springframework.beans.factory.ObjectProvider<AxonServerConfiguration> axonServerConfigProvider, PersistentStreamScheduledExecutorBuilder schedulerBuilder, PersistentStreamEventSourceFactory eventSourceFactory) Instantiates aPersistentStreamConfigurationEnhancer. -
Method Summary
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.axonframework.common.configuration.ConfigurationEnhancer
order
-
Constructor Details
-
PersistentStreamConfigurationEnhancer
public PersistentStreamConfigurationEnhancer(org.springframework.beans.factory.ObjectProvider<AxonServerConfiguration> axonServerConfigProvider, PersistentStreamScheduledExecutorBuilder schedulerBuilder, PersistentStreamEventSourceFactory eventSourceFactory) Instantiates aPersistentStreamConfigurationEnhancer.- Parameters:
axonServerConfigProvider- provider for the Axon Server configuration containing persistent stream settings; resolved lazily to avoid Spring lifecycle ordering issues withSpringComponentRegistryschedulerBuilder- the builder used to create a per-streamScheduledExecutorServiceeventSourceFactory- the eventSourceFactory used to construct each event source
-
-
Method Details
-
enhance
Description copied from interface:ConfigurationEnhancer- Specified by:
enhancein interfaceConfigurationEnhancer- Parameters:
registry- The registry instance to enhance.
-
destroy
public void destroy()- Specified by:
destroyin interfaceorg.springframework.beans.factory.DisposableBean
-