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:
- Start with a static factory method (e.g.,
pooledStreamingProcessor(String)orsubscribingProcessor(String)) - Define which event handlers should be assigned to this processor using
ProcessorDefinition.ProcessorDefinitionSelectorStep.assigningHandlers(Predicate) - Either apply custom configuration using
ProcessorDefinition.ProcessorDefinitionConfigurationStep.withConfiguration(Function)or use default settings withProcessorDefinition.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
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic interfaceDescribes an event handler component that can be assigned to an event processor.static interfaceFinal step in the processor definition fluent API for configuring the processor settings.static interfaceThe second step in the processor definition fluent API for selecting which event handlers should be assigned to the processor. -
Method Summary
Modifier and TypeMethodDescriptionapplySettings(EventProcessorConfiguration settings) Applies this processor's configuration settings to the given settings object.booleanmatchesSelector(ProcessorDefinition.EventHandlerDescriptor eventHandlerDescriptor) Determines whether the given event handler descriptor matches this processor's selection criteria.mode()Returns the mode (type) of this processor.name()Returns the name of this processor.static ProcessorDefinition.ProcessorDefinitionSelectorStep<PooledStreamingEventProcessorConfiguration> Creates a new processor definition for a pooled streaming event processor with the given name.subscribingProcessor(String name) Creates a new processor definition for a subscribing event processor with the given name.
-
Method Details
-
pooledStreamingProcessor
@Nonnull static ProcessorDefinition.ProcessorDefinitionSelectorStep<PooledStreamingEventProcessorConfiguration> pooledStreamingProcessor(@Nonnull String name) 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
@Nonnull static ProcessorDefinition.ProcessorDefinitionSelectorStep<SubscribingEventProcessorConfiguration> subscribingProcessor(@Nonnull String name) 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
Determines whether the given event handler descriptor matches this processor's selection criteria.- Parameters:
eventHandlerDescriptor- The descriptor of the event handler to check.- Returns:
trueif the event handler should be assigned to this processor,falseotherwise.
-
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
Returns the name of this processor.- Returns:
- The processor name.
-
mode
Returns the mode (type) of this processor.- Returns:
- The processor mode.
-