Class SubscribingEventProcessorsConfigurer
SubscribingEventProcessor instances within an application.
The SubscribingEventProcessorsConfigurer provides a centralized way to configure and register multiple
subscribing event processing. It acts as a container that manages individual SubscribingEventProcessorModule
instances, allowing you to set shared defaults that apply to all processing while enabling processor-specific
customizations.
The main purpose is to simplify the configuration of multiple event processing by providing shared configuration
capabilities such as default SubscribableEventSource, and processor settings that apply to all processing
unless explicitly overridden.
The configurer automatically configures default components:
- Automatically wires available
SubscribableEventSourcecomponents to all processing - 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 subscribing event processing configurer. -
Method Summary
Modifier and TypeMethodDescriptionvoidbuild()Builds and registers all configured subscribing event processing.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 subscribing event processor with the specified name and event handling components.defaults(BiFunction<Configuration, SubscribingEventProcessorConfiguration, SubscribingEventProcessorConfiguration> configureDefaults) Configures default settings that will be applied to allSubscribingEventProcessorinstances managed by this configurer.defaults(UnaryOperator<SubscribingEventProcessorConfiguration> configureDefaults) Configures default settings that will be applied to allSubscribingEventProcessorinstances managed by this configurer.processor(String name, Function<EventProcessorModule.EventHandlingPhase<SubscribingEventProcessorModule, SubscribingEventProcessorConfiguration>, SubscribingEventProcessorModule> moduleCustomizer) Registers a subscribing event processor with a custom module configuration.processor(ModuleBuilder<SubscribingEventProcessorModule> moduleBuilder) Registers aSubscribingEventProcessorModuleusing aModuleBuilder.
-
Constructor Details
-
SubscribingEventProcessorsConfigurer
Constructs a new subscribing event processing 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.subscribing(UnaryOperator).- Parameters:
parent- The parentEventProcessingConfigurerthat manages this configurer.
-
-
Method Details
-
build
Builds and registers all configured subscribing event processing.This method is typically called automatically by the framework during configuration building. It registers default components and all configured processor modules.
-
defaults
@Nonnull public SubscribingEventProcessorsConfigurer defaults(@Nonnull BiFunction<Configuration, SubscribingEventProcessorConfiguration, SubscribingEventProcessorConfiguration> configureDefaults) Configures default settings that will be applied to allSubscribingEventProcessorinstances managed by this configurer.This method allows you to specify configurations that should be shared across all subscribing event processing. 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 error handling policies, message interception, or processing configurations that should apply to all processing unless explicitly overridden.
- Parameters:
configureDefaults- A function that receives the Axon configuration and processor configuration, returning a modifiedSubscribingEventProcessorConfigurationwith the desired defaults applied.- Returns:
- This configurer instance for method chaining.
-
defaults
@Nonnull public SubscribingEventProcessorsConfigurer defaults(@Nonnull UnaryOperator<SubscribingEventProcessorConfiguration> configureDefaults) Configures default settings that will be applied to allSubscribingEventProcessorinstances 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 theSubscribingEventProcessorConfigurationwith desired defaults.- Returns:
- This configurer instance for method chaining.
-
defaultProcessor
@Nonnull public SubscribingEventProcessorsConfigurer defaultProcessor(@Nonnull String name, @Nonnull Function<EventHandlingComponentsConfigurer.RequiredComponentPhase, EventHandlingComponentsConfigurer.CompletePhase> eventHandlingComponentsBuilder) Registers a subscribing event processor with the specified name and event handling components. The processor will use the default subscribing 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 SubscribingEventProcessorsConfigurer processor(@Nonnull String name, @Nonnull Function<EventProcessorModule.EventHandlingPhase<SubscribingEventProcessorModule, SubscribingEventProcessorConfiguration>, SubscribingEventProcessorModule> moduleCustomizer) Registers a subscribing event processor with a 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 SubscribingEventProcessorsConfigurer processor(@Nonnull ModuleBuilder<SubscribingEventProcessorModule> moduleBuilder) Registers aSubscribingEventProcessorModuleusing aModuleBuilder.- Parameters:
moduleBuilder- A builder that creates aSubscribingEventProcessorModuleinstance.- Returns:
- This configurer instance for method chaining.
-
componentRegistry
@Nonnull public SubscribingEventProcessorsConfigurer 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.
-