Class PooledStreamingEventProcessorsConfigurer
PooledStreamingEventProcessor instances within an application.
The PooledStreamingEventProcessorsModule provides a centralized way to configure and register multiple pooled
streaming event processors. It acts as a container that manages individual
PooledStreamingEventProcessorModule instances, allowing you to set shared defaults that apply to all
processors while enabling processor-specific customizations.
The main purpose is to simplify the configuration of multiple event processors by providing shared configuration
capabilities such as default TokenStore, StreamableEventSource, and
processor settings that apply to all processors unless explicitly overridden.
The configurer automatically configures default components:
- Registers an
InMemoryTokenStoreif noTokenStoreis present - Automatically wires available
TokenStoreandStreamableEventSourcecomponents to all processors - Applies shared customizations through the
defaults(BiFunction)anddefaults(UnaryOperator)methods
This configurer is typically accessed through EventProcessingConfigurer.pooledStreaming(UnaryOperator)
rather than being instantiated directly.
- Since:
- 5.0.0
- Author:
- Mateusz Nowak
-
Constructor Summary
ConstructorsConstructorDescriptionConstructs a new pooled streaming event processors configurer. -
Method Summary
Modifier and TypeMethodDescriptionvoidbuild()Builds and registers all configured pooled streaming event processors.componentRegistry(Consumer<ComponentRegistry> registryAction) Provides access to the component registry for additional component registrations.defaultProcessor(String name, Function<EventHandlingComponentsConfigurer.RequiredComponentPhase, EventHandlingComponentsConfigurer.CompletePhase> eventHandlingComponentsBuilder) Registers a pooled streaming event processor with the specified name and event handling components.defaults(BiFunction<Configuration, PooledStreamingEventProcessorConfiguration, PooledStreamingEventProcessorConfiguration> configureDefaults) Configures default settings that will be applied to allPooledStreamingEventProcessorinstances managed by this configurer.defaults(UnaryOperator<PooledStreamingEventProcessorConfiguration> configureDefaults) Configures default settings that will be applied to allPooledStreamingEventProcessorinstances managed by this configurer.processor(String name, Function<EventProcessorModule.EventHandlingPhase<PooledStreamingEventProcessorModule, PooledStreamingEventProcessorConfiguration>, PooledStreamingEventProcessorModule> moduleCustomizer) Registers a pooled streaming event processor with custom module configuration.processor(ModuleBuilder<PooledStreamingEventProcessorModule> moduleBuilder) Registers aPooledStreamingEventProcessorModuleusing aModuleBuilder.
-
Constructor Details
-
PooledStreamingEventProcessorsConfigurer
@Internal public PooledStreamingEventProcessorsConfigurer(@Nonnull EventProcessingConfigurer parent) Constructs a new pooled streaming event processors configurer.This constructor is marked as
Internalbecause the configurer is typically created and managed by theEventProcessingConfigurer. Users should not instantiate this class directly but instead access it throughEventProcessingConfigurer.pooledStreaming(UnaryOperator).- Parameters:
parent- The parentEventProcessingConfigurerthat manages this configurer.
-
-
Method Details
-
build
Builds and registers all configured pooled streaming event processors.This method is typically called automatically by the framework during configuration building. It registers default components and all configured processor modules.
-
defaults
@Nonnull public PooledStreamingEventProcessorsConfigurer defaults(@Nonnull BiFunction<Configuration, PooledStreamingEventProcessorConfiguration, PooledStreamingEventProcessorConfiguration> configureDefaults) Configures default settings that will be applied to allPooledStreamingEventProcessorinstances managed by this configurer.This method allows you to specify configurations that should be shared across all pooled streaming event processors. The provided function receives both the Axon
Configurationand the processor configuration, allowing access to application-wide components when setting defaults.Common use cases include setting default buffer sizes, segment counts, thread pool configurations, or error handling policies that should apply to all processors unless explicitly overridden.
- Parameters:
configureDefaults- A function that receives the Axon configuration and processor configuration, returning a modifiedPooledStreamingEventProcessorConfigurationwith the desired defaults applied.- Returns:
- This configurer instance for method chaining.
-
defaults
@Nonnull public PooledStreamingEventProcessorsConfigurer defaults(@Nonnull UnaryOperator<PooledStreamingEventProcessorConfiguration> configureDefaults) Configures default settings that will be applied to allPooledStreamingEventProcessorinstances managed by this configurer.This is a simplified version of
defaults(BiFunction)that provides only the processor configuration for modification, without access to the AxonConfiguration. Use this when your default configurations don't require components from the application configuration.- Parameters:
configureDefaults- A function that modifies thePooledStreamingEventProcessorConfigurationwith desired defaults.- Returns:
- This configurer instance for method chaining.
-
defaultProcessor
@Nonnull public PooledStreamingEventProcessorsConfigurer defaultProcessor(@Nonnull String name, @Nonnull Function<EventHandlingComponentsConfigurer.RequiredComponentPhase, EventHandlingComponentsConfigurer.CompletePhase> eventHandlingComponentsBuilder) Registers a pooled streaming event processor with the specified name and event handling components. The processor will use the default pooled streaming event processor configuration.- Parameters:
name- The unique name for the processor.eventHandlingComponentsBuilder- Function to configure the event handling components.- Returns:
- This configurer instance for method chaining.
-
processor
@Nonnull public PooledStreamingEventProcessorsConfigurer processor(@Nonnull String name, @Nonnull Function<EventProcessorModule.EventHandlingPhase<PooledStreamingEventProcessorModule, PooledStreamingEventProcessorConfiguration>, PooledStreamingEventProcessorModule> moduleCustomizer) Registers a pooled streaming event processor with custom module configuration.- Parameters:
name- The unique name for the processor.moduleCustomizer- Function to customize the processor module configuration.- Returns:
- This configurer instance for method chaining.
-
processor
@Nonnull public PooledStreamingEventProcessorsConfigurer processor(@Nonnull ModuleBuilder<PooledStreamingEventProcessorModule> moduleBuilder) Registers aPooledStreamingEventProcessorModuleusing aModuleBuilder.- Parameters:
moduleBuilder- A builder that creates aPooledStreamingEventProcessorModuleinstance.- Returns:
- This module instance for method chaining.
-
componentRegistry
@Nonnull public PooledStreamingEventProcessorsConfigurer componentRegistry(@Nonnull Consumer<ComponentRegistry> registryAction) Provides access to the component registry for additional component registrations.- Parameters:
registryAction- Action to perform on the component registry.- Returns:
- This configurer instance for method chaining.
-