Interface EventProcessorDefinition
- All Known Subinterfaces:
EventProcessorDefinition.ConfigurationStep<T>
This interface provides a fluent API for defining event processors. The typical usage flow is:
- Start with a static factory method (e.g.,
pooledStreaming(String)orsubscribing(String)) - Define which event handlers should be assigned to this processor using
EventProcessorDefinition.SelectorStep.assigningHandlers(EventHandlerSelector) - Either apply custom configuration using
EventProcessorDefinition.ConfigurationStep.customized(Function)or use default settings withEventProcessorDefinition.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
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic interfaceFinal step in the processor definition fluent API for configuring the processor settings.static interfaceDescribes an event handler component that can be assigned to an event processor.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(EventProcessorDefinition.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.pooledStreaming(String name) Creates a new processor definition for apooled streaming event processorwith the givenname.Creates a new processor definition for apooled streaming event processorwith the givenname, automatically selecting any event handler with a namespace matching thename, and adding them to the pooled streaming event processor.subscribing(String name) Creates a new processor definition for asubscribing event processorwith the givenname.subscribingMatching(String name) Creates a new processor definition for asubscribing event processorwith the givenname, automatically selecting any event handler with a namespace matching thename, and adding them to the subscribing event processor.
-
Method Details
-
pooledStreaming
static EventProcessorDefinition.SelectorStep<PooledStreamingEventProcessorConfiguration> pooledStreaming(String name) Creates a new processor definition for apooled streaming event processorwith the givenname.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
static EventProcessorDefinition.ConfigurationStep<PooledStreamingEventProcessorConfiguration> pooledStreamingMatching(String name) Creates a new processor definition for apooled streaming event processorwith the givenname, automatically selecting any event handler with a namespace matching thename, 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
static EventProcessorDefinition.SelectorStep<SubscribingEventProcessorConfiguration> subscribing(String name) Creates a new processor definition for asubscribing event processorwith the givenname.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
static EventProcessorDefinition.ConfigurationStep<SubscribingEventProcessorConfiguration> subscribingMatching(String name) Creates a new processor definition for asubscribing event processorwith the givenname, automatically selecting any event handler with a namespace matching thename, 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
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
String name()Returns the name of this processor.- Returns:
- The processor name.
-
mode
Returns the mode (type) of this processor.- Returns:
- The processor mode.
-