Interface EventProcessorDefinition

All Known Subinterfaces:
EventProcessorDefinition.ConfigurationStep<T>

public interface EventProcessorDefinition
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., pooledStreaming(String) or subscribing(String))
  2. Define which event handlers should be assigned to this processor using EventProcessorDefinition.SelectorStep.assigningHandlers(EventHandlerSelector)
  3. Either apply custom configuration using EventProcessorDefinition.ConfigurationStep.customized(Function) or use default settings with EventProcessorDefinition.ConfigurationStep.notCustomized()

Example usage:


 EventProcessorDefinition.pooledStreaming("myProcessor")
     .assigningHandlers(descriptor -> descriptor.beanName().startsWith("order"))
     .customized(config -> config.maxClaimedSegments(4));
 

Any configuration set by the `.customized` method will override any configuration provided using properties files.

Since:
5.0.2
Author:
Allard Buijze
  • Method Details

    • pooledStreaming

      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
    • pooledStreamingMatching

      Creates a new processor definition for a pooled streaming event processor with the given name, automatically selecting any event handler with a namespace matching the name, and adding them to the pooled streaming event processor.

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

      Selecting the event handlers is done based on the presence and contents of the Namespace.

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

      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
    • subscribingMatching

      Creates a new processor definition for a subscribing event processor with the given name, automatically selecting any event handler with a namespace matching the name, and adding them to the subscribing event processor.

      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.

      Selecting the event handlers is done based on the presence and contents of the Namespace.

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

      boolean matchesSelector(EventProcessorDefinition.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

      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

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

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