Class PersistentStreamConfigurationEnhancer

java.lang.Object
io.axoniq.framework.springboot.autoconfig.PersistentStreamConfigurationEnhancer
All Implemented Interfaces:
ConfigurationEnhancer, org.springframework.beans.factory.DisposableBean

@Internal @RegistrationScope(scope=CURRENT) public class PersistentStreamConfigurationEnhancer extends Object implements ConfigurationEnhancer, org.springframework.beans.factory.DisposableBean
A ConfigurationEnhancer that registers a PersistentStreamEventSource component 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 implement SubscribableEventSource and 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 PersistentStreamEventSource is delegated to a PersistentStreamEventSourceFactory to allow customization if needed.

The PersistentStreamConfigurationEnhancer also implements DisposableBean and keeps a reference of all ScheduledExecutorService instances created during enhance(ComponentRegistry) 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: