Class DefaultProcessorModuleFactory

java.lang.Object
org.axonframework.extension.spring.config.DefaultProcessorModuleFactory
All Implemented Interfaces:
ProcessorModuleFactory

public class DefaultProcessorModuleFactory extends Object implements ProcessorModuleFactory
Default implementation of ProcessorModuleFactory that assigns event handlers to processors using ProcessorDefinitions.

This factory evaluates each event handler against the configured processor definitions. When a handler matches a definition's selector, it is assigned to that processor. If no processor definition matches, the handler is assigned to a processor named after the handler's package (or "default" if the package cannot be determined).

The factory uses EventProcessorSettings to configure each processor according to its type (pooled streaming or subscribing). Custom configuration from processor definitions is applied on top of the base settings.

Since:
5.0.2
Author:
Allard Buijze
See Also:
  • Constructor Details

    • DefaultProcessorModuleFactory

      public DefaultProcessorModuleFactory(@Nonnull List<ProcessorDefinition> processorDefinitions, @Nonnull Map<String,EventProcessorSettings> settings, @Nonnull Configuration axonConfiguration)
      Creates a new factory with the given processor definitions, settings, and Axon configuration.
      Parameters:
      processorDefinitions - The list of processor definitions that define handler assignment rules.
      settings - The map of processor settings, keyed by processor name.
      axonConfiguration - The Axon configuration to retrieve components from.
  • Method Details

    • buildProcessorModules

      @Nonnull public Set<EventProcessorModule> buildProcessorModules(@Nonnull Set<ProcessorDefinition.EventHandlerDescriptor> handlers)
      Builds a set of EventProcessorModules from the given event handler descriptors.

      Each module represents an event processor with its assigned event handlers. The factory determines the assignment logic and creates appropriately configured modules.

      This implementation groups handlers by their assigned processor name (determined by assignedProcessor(ProcessorDefinition.EventHandlerDescriptor)), then creates an EventProcessorModule for each processor with its assigned handlers.

      Specified by:
      buildProcessorModules in interface ProcessorModuleFactory
      Parameters:
      handlers - The set of discovered event handler components to be assigned to processors.
      Returns:
      A set of event processor modules, each containing its assigned event handlers.