Interface ProcessorDefinition


public interface ProcessorDefinition
Defines the configuration for an event processor, including which event handlers it should process and how it should be configured.

This interface provides a fluent API for defining event processors. The typical usage flow is:

  1. Start with a static factory method (e.g., pooledStreamingProcessor(String) or subscribingProcessor(String))
  2. Define which event handlers should be assigned to this processor using ProcessorDefinition.ProcessorDefinitionSelectorStep.assigningHandlers(Predicate)
  3. Either apply custom configuration using ProcessorDefinition.ProcessorDefinitionConfigurationStep.withConfiguration(Function) or use default settings with ProcessorDefinition.ProcessorDefinitionConfigurationStep.withDefaultSettings()

Example usage:


 ProcessorDefinition.pooledStreamingProcessor("myProcessor")
     .assigningHandlers(descriptor -> descriptor.beanName().startsWith("order"))
     .withConfiguration(config -> config.maxClaimedSegments(4));
 
Any configuration set by the `.withConfiguration` method will override any configuration provided using properties files.
Since:
5.0.2
Author:
Allard Buijze
  • Method Details

    • pooledStreamingProcessor

      Creates a new processor definition for a pooled streaming event processor with the given name.

      Pooled streaming event processors distribute event processing across multiple threads, allowing for parallel processing of events within a single processor instance.

      Parameters:
      name - The name of the processor.
      Returns:
      The next step in the fluent API to define the handler selection criteria.
    • subscribingProcessor

      Creates a new processor definition for a subscribing event processor with the given name.

      With Subscribing event processors, the processor relies on the threading model of the SubscribableEventSource, potentially providing low-latency processing but without the ability to replay events or track progress.

      Parameters:
      name - The name of the processor.
      Returns:
      The next step in the fluent API to define the handler selection criteria.
    • matchesSelector

      boolean matchesSelector(@Nonnull ProcessorDefinition.EventHandlerDescriptor eventHandlerDescriptor)
      Determines whether the given event handler descriptor matches this processor's selection criteria.
      Parameters:
      eventHandlerDescriptor - The descriptor of the event handler to check.
      Returns:
      true if the event handler should be assigned to this processor, false otherwise.
    • applySettings

      @Nonnull EventProcessorConfiguration applySettings(@Nonnull EventProcessorConfiguration settings)
      Applies this processor's configuration settings to the given settings object.
      Parameters:
      settings - The base settings to apply configuration to.
      Returns:
      The configured settings, potentially modified by this processor's configuration.
    • name

      @Nonnull String name()
      Returns the name of this processor.
      Returns:
      The processor name.
    • mode

      Returns the mode (type) of this processor.
      Returns:
      The processor mode.