public class EventProcessingModule extends Object implements ModuleConfiguration, EventProcessingConfiguration, EventProcessingConfigurer
EventProcessingConfiguration
and takes care of module lifecycle.EventProcessingConfigurer.DeadLetteringInvokerConfiguration, EventProcessingConfigurer.EventProcessorBuilder, EventProcessingConfigurer.PooledStreamingProcessorConfiguration
Constructor and Description |
---|
EventProcessingModule() |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
isType, phase, shutdown, start, unwrap
eventProcessor, eventProcessor, eventProcessorByProcessingGroup, sagaConfiguration, sagaEventProcessor
assignHandlerInstancesMatching, assignHandlerTypesMatching, byDefaultAssignTo, registerMessageMonitor, registerPooledStreamingEventProcessor, registerPooledStreamingEventProcessor, registerSaga, registerSubscribingEventProcessor, registerTrackingEventProcessor, usingPooledStreamingEventProcessors
protected final Map<String,Component<EventProcessor>> eventProcessors
protected final Map<String,DeadLetteringEventHandlerInvoker> deadLetteringEventHandlerInvokers
protected final List<BiFunction<Configuration,String,MessageHandlerInterceptor<? super EventMessage<?>>>> defaultHandlerInterceptors
protected final Map<String,List<Function<Configuration,MessageHandlerInterceptor<? super EventMessage<?>>>>> handlerInterceptorsBuilders
protected final Map<String,Component<ListenerInvocationErrorHandler>> listenerInvocationErrorHandlers
protected final Map<String,Component<ErrorHandler>> errorHandlers
protected final Map<String,Component<SequencingPolicy<? super EventMessage<?>>>> sequencingPolicies
protected final Map<String,MessageMonitorFactory> messageMonitorFactories
protected final Map<String,Component<TokenStore>> tokenStore
protected final Map<String,Component<RollbackConfiguration>> rollbackConfigurations
protected final Map<String,Component<TransactionManager>> transactionManagers
protected final Map<String,Component<SequencedDeadLetterQueue<EventMessage<?>>>> deadLetterQueues
protected final Map<String,Component<EnqueuePolicy<EventMessage<?>>>> deadLetterPolicies
protected final Map<String,Component<TrackingEventProcessorConfiguration>> tepConfigs
protected final Map<String,EventProcessingConfigurer.PooledStreamingProcessorConfiguration> psepConfigs
protected final Map<String,EventProcessingConfigurer.DeadLetteringInvokerConfiguration> deadLetteringInvokerConfigs
protected Function<String,Function<Configuration,SequencedDeadLetterQueue<EventMessage<?>>>> deadLetterQueueProvider
protected Configuration configuration
public void initialize(Configuration configuration)
ModuleConfiguration
config
. Any specific start up or shut down
processes should be added here by using the provided config
and invoke LifecycleOperations.onStart(int,
LifecycleHandler)
and LifecycleOperations.onShutdown(int, LifecycleHandler)
respectively.initialize
in interface ModuleConfiguration
configuration
- the global configuration, providing access to generic componentspublic <T extends EventProcessor> Optional<T> eventProcessorByProcessingGroup(String processingGroup)
EventProcessingConfiguration
EventProcessor
by it's processingGroup
.eventProcessorByProcessingGroup
in interface EventProcessingConfiguration
T
- the type of the expected EventProcessor
processingGroup
- a String
specifying the processing group of an EventProcessor
Optional
referencing the EventProcessor
public Map<String,EventProcessor> eventProcessors()
EventProcessingConfiguration
EventProcessor
s.eventProcessors
in interface EventProcessingConfiguration
Map
of registered EventProcessor
s within this configuration with the processor names as
keyspublic String sagaProcessingGroup(Class<?> sagaType)
EventProcessingConfiguration
sagaType
.sagaProcessingGroup
in interface EventProcessingConfiguration
sagaType
- the type of Sagapublic List<MessageHandlerInterceptor<? super EventMessage<?>>> interceptorsFor(String processorName)
EventProcessingConfiguration
interceptorsFor
in interface EventProcessingConfiguration
processorName
- a String
specifying a processing groupList
of MessageHandlerInterceptor
s for a processor with given processorName
public ListenerInvocationErrorHandler listenerInvocationErrorHandler(String processingGroup)
EventProcessingConfiguration
ListenerInvocationErrorHandler
tied to the given processingGroup
.listenerInvocationErrorHandler
in interface EventProcessingConfiguration
processingGroup
- a String
specifying a processing groupListenerInvocationErrorHandler
belonging to the given processingGroup
public SequencingPolicy<? super EventMessage<?>> sequencingPolicy(String processingGroup)
EventProcessingConfiguration
SequencingPolicy
tied to the given processingGroup
.sequencingPolicy
in interface EventProcessingConfiguration
processingGroup
- a String
specifying a processing groupSequencingPolicy
belonging to the given processingGroup
public RollbackConfiguration rollbackConfiguration(String processorName)
EventProcessingConfiguration
RollbackConfiguration
tied to the given processorName
.rollbackConfiguration
in interface EventProcessingConfiguration
processorName
- a String
specifying a processing groupRollbackConfiguration
belonging to the given processorName
public ErrorHandler errorHandler(String processorName)
EventProcessingConfiguration
ErrorHandler
tied to the given processorName
.errorHandler
in interface EventProcessingConfiguration
processorName
- a String
specifying a processing groupErrorHandler
belonging to the given processorName
public SagaStore sagaStore()
EventProcessingConfiguration
SagaStore
registered within this configuration.sagaStore
in interface EventProcessingConfiguration
SagaStore
registered within this configurationpublic List<SagaConfiguration<?>> sagaConfigurations()
EventProcessingConfiguration
List
of SagaConfiguration
s registered within this configuration.sagaConfigurations
in interface EventProcessingConfiguration
List
of SagaConfiguration
s registered within this configurationpublic MessageMonitor<? super Message<?>> messageMonitor(Class<?> componentType, String eventProcessorName)
EventProcessingConfiguration
MessageMonitor
set to the given componentType
and componentName
registered
within this configuration.messageMonitor
in interface EventProcessingConfiguration
componentType
- a Class
type of component to be monitoredeventProcessorName
- a String
specifying the name of the component to be monitoredMessageMonitor
registered to the given componentType
and componentName
public TokenStore tokenStore(String processorName)
EventProcessingConfiguration
TokenStore
tied to the given processorName
.tokenStore
in interface EventProcessingConfiguration
processorName
- a String
specifying a event processorTokenStore
belonging to the given processorName
public TransactionManager transactionManager(String processorName)
EventProcessingConfiguration
TransactionManager
tied to the given processorName
.transactionManager
in interface EventProcessingConfiguration
processorName
- a String
specifying a processing groupTransactionManager
belonging to the given processorName
public Optional<SequencedDeadLetterQueue<EventMessage<?>>> deadLetterQueue(@Nonnull String processingGroup)
EventProcessingConfiguration
SequencedDeadLetterQueue
tied to the given processingGroup
in an Optional
.
May return an empty optional
when there's no SequencedDeadLetterQueue
present
for the given processingGroup
.deadLetterQueue
in interface EventProcessingConfiguration
processingGroup
- The name of the processing group for which to return a SequencedDeadLetterQueue
.SequencedDeadLetterQueue
tied to the given processingGroup
, Optional.empty()
if there is none.public Optional<EnqueuePolicy<EventMessage<?>>> deadLetterPolicy(@Nonnull String processingGroup)
EventProcessingConfiguration
dead letter policy
tied to the given processingGroup
in an
Optional
. May return an Optional
containing the
default policy
if present.deadLetterPolicy
in interface EventProcessingConfiguration
processingGroup
- The name of the processing group for which to return an EnqueuePolicy
.EnqueuePolicy
belonging to the given processingGroup
.public Optional<SequencedDeadLetterProcessor<EventMessage<?>>> sequencedDeadLetterProcessor(@Nonnull String processingGroup)
EventProcessingConfiguration
SequencedDeadLetterProcessor
tied to the given processingGroup
in an
Optional
. Returns an empty optional
when the processingGroup
does not
have a SequencedDeadLetterQueue
attached to it.sequencedDeadLetterProcessor
in interface EventProcessingConfiguration
processingGroup
- The name of the processing group for which to return an EnqueuePolicy
.SequencedDeadLetterProcessor
tied to the given processingGroup
in an
Optional
, Optional.empty()
if there is none.public <T> EventProcessingConfigurer registerSaga(Class<T> sagaType, Consumer<SagaConfigurer<T>> sagaConfigurer)
EventProcessingConfigurer
registerSaga
in interface EventProcessingConfigurer
T
- The type of Saga to configuresagaType
- The type of Saga to configuresagaConfigurer
- a function providing modifications on top of the default configurationEventProcessingConfigurer
instance, for fluent interfacingpublic EventProcessingConfigurer registerSagaStore(Function<Configuration,SagaStore> sagaStoreBuilder)
EventProcessingConfigurer
registerSagaStore
in interface EventProcessingConfigurer
sagaStoreBuilder
- a Function
that builds a SagaStore
EventProcessingConfigurer
instance, for fluent interfacingpublic EventProcessingConfigurer registerEventHandler(Function<Configuration,Object> eventHandlerBuilder)
EventProcessingConfigurer
Function
that builds an Event Handler instance.registerEventHandler
in interface EventProcessingConfigurer
eventHandlerBuilder
- a Function
that builds an Event Handler instanceEventProcessingConfigurer
instance, for fluent interfacingpublic EventProcessingConfigurer registerDefaultListenerInvocationErrorHandler(Function<Configuration,ListenerInvocationErrorHandler> listenerInvocationErrorHandlerBuilder)
EventProcessingConfigurer
Function
that builds the default ListenerInvocationErrorHandler
.
Defaults to a LoggingErrorHandler
.registerDefaultListenerInvocationErrorHandler
in interface EventProcessingConfigurer
listenerInvocationErrorHandlerBuilder
- a Function
that builds the default
ListenerInvocationErrorHandler
EventProcessingConfigurer
instance, for fluent interfacingpublic EventProcessingConfigurer registerListenerInvocationErrorHandler(String processingGroup, Function<Configuration,ListenerInvocationErrorHandler> listenerInvocationErrorHandlerBuilder)
EventProcessingConfigurer
registerListenerInvocationErrorHandler
in interface EventProcessingConfigurer
processingGroup
- a String
specifying the name of a processing grouplistenerInvocationErrorHandlerBuilder
- a Function
that builds ListenerInvocationErrorHandler
EventProcessingConfigurer
instance, for fluent interfacingpublic EventProcessingConfigurer configureDefaultStreamableMessageSource(Function<Configuration,StreamableMessageSource<TrackedEventMessage<?>>> defaultSource)
EventProcessingConfigurer
StreamableMessageSource
to use for Tracking Event Processors if none was explicitly
provided. Defaults to the Event Bus (or Store) available in the Configuration.
Note that the configuration of a default source does not change how the decision is made to select the
type of processor. Unless explicitly specified using EventProcessingConfigurer.usingSubscribingEventProcessors()
or
EventProcessingConfigurer.usingTrackingEventProcessors()
, the default is dependent on the type of Message Source the Event Bus
provides. If the Event Bus supports Tracking Processors, that is the default, otherwise Subscribing Event
Processors are the default.
configureDefaultStreamableMessageSource
in interface EventProcessingConfigurer
defaultSource
- a Function that defines the Message source to useEventProcessingConfigurer
instance, for fluent interfacingpublic EventProcessingConfigurer configureDefaultSubscribableMessageSource(Function<Configuration,SubscribableMessageSource<EventMessage<?>>> defaultSource)
EventProcessingConfigurer
SubscribableMessageSource
to use for Subscribing Event Processors if none was explicitly
provided. Defaults to the Event Bus (or Store) available in the Configuration.
Note that the configuration of a default source does not change how the decision is made to select the
type of processor. Unless explicitly specified using EventProcessingConfigurer.usingSubscribingEventProcessors()
or
EventProcessingConfigurer.usingTrackingEventProcessors()
, the default is dependent on the type of Message Source the Event Bus
provides. If the Event Bus supports Tracking Processors, that is the default, otherwise Subscribing Event
Processors are the default.
configureDefaultSubscribableMessageSource
in interface EventProcessingConfigurer
defaultSource
- a Function that defines the Message source to useEventProcessingConfigurer
instance, for fluent interfacingpublic EventProcessingConfigurer registerTrackingEventProcessor(String name, Function<Configuration,StreamableMessageSource<TrackedEventMessage<?>>> source)
EventProcessingConfigurer
registerTrackingEventProcessor
in interface EventProcessingConfigurer
name
- a String
specifying the name of the TrackingEventProcessor
being registeredsource
- a Function
that builds a StreamableMessageSource
EventProcessingConfigurer
instance, for fluent interfacingpublic EventProcessingConfigurer registerTrackingEventProcessor(String name, Function<Configuration,StreamableMessageSource<TrackedEventMessage<?>>> source, Function<Configuration,TrackingEventProcessorConfiguration> processorConfiguration)
EventProcessingConfigurer
TrackingEventProcessor
with given name
, source
and processorConfiguration
within this Configurer.registerTrackingEventProcessor
in interface EventProcessingConfigurer
name
- a String
specifying the name of the TrackingEventProcessor
being registeredsource
- a Function
that builds StreamableMessageSource
processorConfiguration
- a Function
that builds a TrackingEventProcessorConfiguration
EventProcessingConfigurer
instance, for fluent interfacingpublic EventProcessingConfigurer registerEventProcessorFactory(EventProcessingConfigurer.EventProcessorBuilder eventProcessorBuilder)
EventProcessingConfigurer
EventProcessor
. This is the EventProcessingConfigurer.EventProcessorBuilder
to
be used when there is no specific builder for given processor name.registerEventProcessorFactory
in interface EventProcessingConfigurer
eventProcessorBuilder
- a Function
that builds an EventProcessor
EventProcessingConfigurer
instance, for fluent interfacingpublic EventProcessingConfigurer registerEventProcessor(String name, EventProcessingConfigurer.EventProcessorBuilder eventProcessorBuilder)
EventProcessingConfigurer
EventProcessingConfigurer.EventProcessorBuilder
for the given processor name
.registerEventProcessor
in interface EventProcessingConfigurer
name
- a String
specifying the name of the EventProcessor
being registeredeventProcessorBuilder
- a Function
that builds an EventProcessor
EventProcessingConfigurer
instance, for fluent interfacingpublic EventProcessingConfigurer registerTokenStore(String processorName, Function<Configuration,TokenStore> tokenStore)
EventProcessingConfigurer
registerTokenStore
in interface EventProcessingConfigurer
processorName
- a String
specifying the name of a event processortokenStore
- a Function
that builds a TokenStore
EventProcessingConfigurer
instance, for fluent interfacingpublic EventProcessingConfigurer registerTokenStore(Function<Configuration,TokenStore> tokenStore)
EventProcessingConfigurer
Function
that builds a TokenStore
to use as the default in case no explicit token
store was configured for a processor.registerTokenStore
in interface EventProcessingConfigurer
tokenStore
- a Function
that builds a TokenStore
EventProcessingConfigurer
instance, for fluent interfacingpublic EventProcessingConfigurer usingSubscribingEventProcessors()
EventProcessingConfigurer
SubscribingEventProcessor
.
The default behavior depends on the EventBus available in the Configuration. If the Event Bus is a
StreamableMessageSource
, processors are Tracking by default. This method must be used to force the use
of Subscribing Processors, unless specifically overridden for individual processors.
usingSubscribingEventProcessors
in interface EventProcessingConfigurer
EventProcessingConfigurer
instance, for fluent interfacingpublic EventProcessingConfigurer usingTrackingEventProcessors()
EventProcessingConfigurer
TrackingEventProcessor
.
The default behavior depends on the EventBus available in the Configuration. If the Event Bus is a
StreamableMessageSource
, processors are Tracking by default. This method must be used to force the use
of Tracking Processors, unless specifically overridden for individual processors.
usingTrackingEventProcessors
in interface EventProcessingConfigurer
EventProcessingConfigurer
instance, for fluent interfacingpublic EventProcessingConfigurer usingPooledStreamingEventProcessors()
EventProcessingConfigurer
PooledStreamingEventProcessor
.
The default behavior depends on the EventBus
available in the Configuration
. If the EventBus
is a StreamableMessageSource
, processors are Tracking by default. This method must be used to
force the use of Pooled Streaming Processors, unless specifically overridden for individual processors.
usingPooledStreamingEventProcessors
in interface EventProcessingConfigurer
EventProcessingConfigurer
instance, for fluent interfacingpublic EventProcessingConfigurer registerSubscribingEventProcessor(String name, Function<Configuration,SubscribableMessageSource<? extends EventMessage<?>>> messageSource)
EventProcessingConfigurer
registerSubscribingEventProcessor
in interface EventProcessingConfigurer
name
- a String
specyfing the name of the SubscribingEventProcessor
being registeredmessageSource
- a Function
that builds a SubscribableMessageSource
EventProcessingConfigurer
instance, for fluent interfacingpublic EventProcessingConfigurer registerDefaultErrorHandler(Function<Configuration,ErrorHandler> errorHandlerBuilder)
EventProcessingConfigurer
registerDefaultErrorHandler
in interface EventProcessingConfigurer
errorHandlerBuilder
- a Function
that builds an ErrorHandler
EventProcessingConfigurer
instance, for fluent interfacingpublic EventProcessingConfigurer registerErrorHandler(String eventProcessorName, Function<Configuration,ErrorHandler> errorHandlerBuilder)
EventProcessingConfigurer
registerErrorHandler
in interface EventProcessingConfigurer
eventProcessorName
- a String
specifying the name of an EventProcessor
errorHandlerBuilder
- a Function
that builds an ErrorHandler
EventProcessingConfigurer
instance, for fluent interfacingpublic EventProcessingConfigurer byDefaultAssignHandlerInstancesTo(Function<Object,String> assignmentFunction)
EventProcessingConfigurer
Function
that defines the Event Processing Group name to assign Event Handler beans to when
no other, more explicit, rule matches and no ProcessingGroup
annotation is found.byDefaultAssignHandlerInstancesTo
in interface EventProcessingConfigurer
assignmentFunction
- a Function
that returns the Processing Group for each Event Handler beanEventProcessingConfigurer
instance, for fluent interfacingpublic EventProcessingConfigurer byDefaultAssignHandlerTypesTo(Function<Class<?>,String> assignmentFunction)
EventProcessingConfigurer
Function
that defines the Event Processing Group name to assign Event Handler and Saga beans
to when no other, more explicit, rule matches and no ProcessingGroup
annotation is found.byDefaultAssignHandlerTypesTo
in interface EventProcessingConfigurer
assignmentFunction
- a Function
that returns the Processing Group for each Event Handler or Saga
beanEventProcessingConfigurer
instance, for fluent interfacingpublic EventProcessingConfigurer assignHandlerInstancesMatching(String processingGroup, int priority, Predicate<Object> criteria)
EventProcessingConfigurer
criteria
to the Processing Group
with given name
, with given priority
. Rules with higher value of priority
take precedence
over those with a lower value.
Note that, when beans match multiple criteria for different processing groups with equal priority, the outcome is undefined.
assignHandlerInstancesMatching
in interface EventProcessingConfigurer
processingGroup
- a String
specifying the name of a processing group to assign matching Event
Handlers topriority
- The priority for this rulecriteria
- a Predicate
defining the criteria for an Event Handler to matchEventProcessingConfigurer
instance, for fluent interfacingpublic EventProcessingConfigurer assignHandlerTypesMatching(String processingGroup, int priority, Predicate<Class<?>> criteria)
EventProcessingConfigurer
criteria
to the Processing Group
with given name
, with given priority
. Rules with higher value of priority
take precedence
over those with a lower value.
Note that, when beans match multiple criteria for different processing groups with equal priority, the outcome is undefined.
assignHandlerTypesMatching
in interface EventProcessingConfigurer
processingGroup
- a String
specifying the name of the Processing Group to assign matching Event
Handlers or Sagas topriority
- an int
specifying the priority of this rulecriteria
- a Predicate
defining the criteria for an Event Handler or Saga to matchEventProcessingConfigurer
instance, for fluent interfacingpublic EventProcessingConfigurer assignProcessingGroup(String processingGroup, String processorName)
EventProcessingConfigurer
assignProcessingGroup
in interface EventProcessingConfigurer
processingGroup
- a String
specifying the processing group to be assignedprocessorName
- a String
specifying the processor name to assign the group toEventProcessingConfigurer
instance, for fluent interfacingpublic EventProcessingConfigurer assignProcessingGroup(Function<String,String> assignmentRule)
EventProcessingConfigurer
assignProcessingGroup
in interface EventProcessingConfigurer
assignmentRule
- a Function
which takes a processing group and returns a processor nameEventProcessingConfigurer
instance, for fluent interfacingEventProcessingConfigurer.assignProcessingGroup(String, String)
public EventProcessingConfigurer registerHandlerInterceptor(String processorName, Function<Configuration,MessageHandlerInterceptor<? super EventMessage<?>>> interceptorBuilder)
EventProcessingConfigurer
interceptorBuilder
to build a MessageHandlerInterceptor
for the
EventProcessor
with given processorName
.
The interceptorBuilder
may return null
, in which case the return value is ignored.
registerHandlerInterceptor
in interface EventProcessingConfigurer
processorName
- a String
specyfing the name of the processor to register the
MessageHandlerInterceptor
oninterceptorBuilder
- a Function
providing the MessageHandlerInterceptor
to register, or
null
EventProcessingConfigurer
instance, for fluent interfacingpublic EventProcessingConfigurer registerDefaultHandlerInterceptor(BiFunction<Configuration,String,MessageHandlerInterceptor<? super EventMessage<?>>> interceptorBuilder)
EventProcessingConfigurer
interceptorBuilder
as a default to build a MessageHandlerInterceptor
for
EventProcessor
s created in this configuration.
The interceptorBuilder
is invoked once for each processor created, and may return null
, in which
case the return value is ignored.
registerDefaultHandlerInterceptor
in interface EventProcessingConfigurer
interceptorBuilder
- a builder Function
that provides a MessageHandlerInterceptor
for each
available processorEventProcessingConfigurer
instance, for fluent interfacingpublic EventProcessingConfigurer registerSequencingPolicy(String processingGroup, Function<Configuration,SequencingPolicy<? super EventMessage<?>>> policyBuilder)
EventProcessingConfigurer
SequencingPolicy
created by the given policyBuilder
to the processing group with
given processingGroup
. Any previously configured policy for the same name will be overwritten.registerSequencingPolicy
in interface EventProcessingConfigurer
processingGroup
- a String
specifying the name of the processing group to assign the
SequencingPolicy
forpolicyBuilder
- a builder Function
to create the SequencingPolicy
to useEventProcessingConfigurer
instance, for fluent interfacingpublic EventProcessingConfigurer registerDefaultSequencingPolicy(Function<Configuration,SequencingPolicy<? super EventMessage<?>>> policyBuilder)
EventProcessingConfigurer
SequencingPolicy
created by given policyBuilder
to the processing groups for which
no explicit policy is defined (using EventProcessingConfigurer.registerSequencingPolicy(String, Function)
).
Defaults to a SequentialPerAggregatePolicy
.
registerDefaultSequencingPolicy
in interface EventProcessingConfigurer
policyBuilder
- a builder Function
to create the SequencingPolicy
to useEventProcessingConfigurer
instance, for fluent interfacingpublic EventProcessingConfigurer registerMessageMonitorFactory(String eventProcessorName, MessageMonitorFactory messageMonitorFactory)
EventProcessingConfigurer
registerMessageMonitorFactory
in interface EventProcessingConfigurer
eventProcessorName
- a String
specifying the name of an EventProcessor
messageMonitorFactory
- a MessageMonitorFactory
used to create a MessageMonitor
EventProcessingConfigurer
instance, for fluent interfacingpublic EventProcessingConfigurer registerRollbackConfiguration(String name, Function<Configuration,RollbackConfiguration> rollbackConfigurationBuilder)
EventProcessingConfigurer
Function
that builds the RollbackConfiguration
for given processor name
.
Defaults to a RollbackConfigurationType.ANY_THROWABLE
registerRollbackConfiguration
in interface EventProcessingConfigurer
name
- a String
specifying the name of an EventProcessor
rollbackConfigurationBuilder
- a Function
that builds a RollbackConfiguration
EventProcessingConfigurer
instance, for fluent interfacingpublic EventProcessingConfigurer registerTransactionManager(String name, Function<Configuration,TransactionManager> transactionManagerBuilder)
EventProcessingConfigurer
registerTransactionManager
in interface EventProcessingConfigurer
name
- a String
specifying the name of an EventProcessor
transactionManagerBuilder
- a Function
that builds a TransactionManager
EventProcessingConfigurer
instance, for fluent interfacingpublic EventProcessingConfigurer registerDefaultTransactionManager(Function<Configuration,TransactionManager> transactionManagerBuilder)
EventProcessingConfigurer
TransactionManager
for all EventProcessor
s. The provided TransactionManager
is used whenever no processor specific TransactionManager
is configured.registerDefaultTransactionManager
in interface EventProcessingConfigurer
transactionManagerBuilder
- a Function
that builds a TransactionManager
EventProcessingConfigurer
instance, for fluent interfacingpublic EventProcessingConfigurer registerTrackingEventProcessorConfiguration(String name, Function<Configuration,TrackingEventProcessorConfiguration> trackingEventProcessorConfigurationBuilder)
EventProcessingConfigurer
Function
that builds a TrackingEventProcessorConfiguration
to be used by the EventProcessor
corresponding to the given name
.registerTrackingEventProcessorConfiguration
in interface EventProcessingConfigurer
name
- a String
specifying the name of an EventProcessor
trackingEventProcessorConfigurationBuilder
- a Function
that builds a TrackingEventProcessorConfiguration
EventProcessingConfigurer
instance, for fluent interfacingpublic EventProcessingConfigurer registerTrackingEventProcessorConfiguration(Function<Configuration,TrackingEventProcessorConfiguration> trackingEventProcessorConfigurationBuilder)
EventProcessingConfigurer
Function
that builds a TrackingEventProcessorConfiguration
to use as the default.registerTrackingEventProcessorConfiguration
in interface EventProcessingConfigurer
trackingEventProcessorConfigurationBuilder
- a Function
that builds a TrackingEventProcessorConfiguration
EventProcessingConfigurer
instance, for fluent interfacingpublic EventProcessingConfigurer registerPooledStreamingEventProcessor(String name, Function<Configuration,StreamableMessageSource<TrackedEventMessage<?>>> messageSource, EventProcessingConfigurer.PooledStreamingProcessorConfiguration processorConfiguration)
EventProcessingConfigurer
PooledStreamingEventProcessor
in this EventProcessingConfigurer
. The processor will
receive the given name
and use the outcome of the messageSource
as the StreamableMessageSource
.
The processorConfiguration
will be used to further configure the PooledStreamingEventProcessor
upon construction. Note that the processorConfiguration
will override any configuration set through the
EventProcessingConfigurer.registerPooledStreamingEventProcessorConfiguration(PooledStreamingProcessorConfiguration)
and EventProcessingConfigurer.registerPooledStreamingEventProcessorConfiguration(String, PooledStreamingProcessorConfiguration)
.
registerPooledStreamingEventProcessor
in interface EventProcessingConfigurer
name
- the name of the PooledStreamingEventProcessor
being registeredmessageSource
- constructs a StreamableMessageSource
to be used by the PooledStreamingEventProcessor
processorConfiguration
- allows further customization of the PooledStreamingEventProcessor
under
construction. The given Configuration
can be used to extract components and
use them in the PooledStreamingEventProcessor.Builder
EventProcessingConfigurer
instance, for fluent interfacingpublic EventProcessingConfigurer registerPooledStreamingEventProcessorConfiguration(String name, EventProcessingConfigurer.PooledStreamingProcessorConfiguration pooledStreamingProcessorConfiguration)
EventProcessingConfigurer
EventProcessingConfigurer.PooledStreamingProcessorConfiguration
to be used when constructing a PooledStreamingEventProcessor
with name
.registerPooledStreamingEventProcessorConfiguration
in interface EventProcessingConfigurer
name
- the name of an PooledStreamingEventProcessor
pooledStreamingProcessorConfiguration
- configuration used when constructing a PooledStreamingEventProcessor
with the given name
EventProcessingConfigurer
instance, for fluent interfacingpublic EventProcessingConfigurer registerDeadLetterQueue(@Nonnull String processingGroup, @Nonnull Function<Configuration,SequencedDeadLetterQueue<EventMessage<?>>> queueBuilder)
EventProcessingConfigurer
SequencedDeadLetterQueue
for the given processingGroup
. The
SequencedDeadLetterQueue
will automatically enqueue failed events and evaluate them per the queue's
configuration.registerDeadLetterQueue
in interface EventProcessingConfigurer
processingGroup
- A String
specifying the name of the processing group to register the given
SequencedDeadLetterQueue
for.queueBuilder
- A builder method returning a SequencedDeadLetterQueue
based on a
Configuration
. The outcome is used by the given processingGroup
to enqueue
and evaluate failed events in.EventProcessingConfigurer
instance, for fluent interfacing.public EventProcessingConfigurer registerDefaultDeadLetterPolicy(@Nonnull Function<Configuration,EnqueuePolicy<EventMessage<?>>> policyBuilder)
EventProcessingConfigurer
dead letter policy
for any processing group using a
dead letter queue
. The processing group uses the policy to
deduce whether a failed EventMessage
should be
enqueued
for later evaluation.
Note that the configured component will not be used if the processing group does not have a dead letter queue.
registerDefaultDeadLetterPolicy
in interface EventProcessingConfigurer
policyBuilder
- A builder method to construct a default dead letter policy
.EventProcessingConfigurer
instance, for fluent interfacing.public EventProcessingConfigurer registerDeadLetterPolicy(@Nonnull String processingGroup, @Nonnull Function<Configuration,EnqueuePolicy<EventMessage<?>>> policyBuilder)
EventProcessingConfigurer
dead letter policy
for the given processingGroup
using a
dead letter queue
. The processing group uses the policy to
deduce whether a failed EventMessage
should be
enqueued
for later evaluation.
Note that the configured component will not be used if the processing group does not have a dead letter queue.
registerDeadLetterPolicy
in interface EventProcessingConfigurer
processingGroup
- The name of the processing group to build an EnqueuePolicy
for.policyBuilder
- A builder method to construct a dead letter policy
for the given
processingGroup
.EventProcessingConfigurer
instance, for fluent interfacing.public EventProcessingConfigurer registerDeadLetteringEventHandlerInvokerConfiguration(@Nonnull String processingGroup, @Nonnull EventProcessingConfigurer.DeadLetteringInvokerConfiguration configuration)
EventProcessingConfigurer
EventProcessingConfigurer.DeadLetteringInvokerConfiguration
for the given processingGroup
. This configuration
object allows for fine-grained customization of a
dead lettering processing group
through its
builder
.
Note that the configured component will not be used if the processing group does not have a dead letter queue.
registerDeadLetteringEventHandlerInvokerConfiguration
in interface EventProcessingConfigurer
processingGroup
- The name of the processing group to attach additional configuration too.configuration
- The additional configuration for the dead lettering processing group.EventProcessingConfigurer
instance, for fluent interfacing.public EventProcessingConfigurer registerPooledStreamingEventProcessorConfiguration(EventProcessingConfigurer.PooledStreamingProcessorConfiguration pooledStreamingProcessorConfiguration)
EventProcessingConfigurer
EventProcessingConfigurer.PooledStreamingProcessorConfiguration
to be used when constructing every PooledStreamingEventProcessor
.registerPooledStreamingEventProcessorConfiguration
in interface EventProcessingConfigurer
pooledStreamingProcessorConfiguration
- configuration used when constructing every PooledStreamingEventProcessor
EventProcessingConfigurer
instance, for fluent interfacingpublic EventProcessingConfigurer registerDeadLetterQueueProvider(Function<String,Function<Configuration,SequencedDeadLetterQueue<EventMessage<?>>>> deadLetterQueueProvider)
EventProcessingConfigurer
deadLetterProvider
as a default to build a SequencedDeadLetterQueue
for
EventProcessor
s created in this configuration.
The deadLetterProvider
might return null if the given processing group name should not have a sequenced
dead letter queue. An explicitly sequenced dead letter queue set using
EventProcessingConfigurer.registerDeadLetterQueue(String, Function)
will always have precedence over the one provided by this method.
registerDeadLetterQueueProvider
in interface EventProcessingConfigurer
deadLetterQueueProvider
- a builder Function
that provides a SequencedDeadLetterQueue
for a
processing group. It's possible to return null depending on the processing group.EventProcessingConfigurer
instance, for fluent interfacingprotected EventProcessor subscribingEventProcessor(String name, EventHandlerInvoker eventHandlerInvoker, SubscribableMessageSource<? extends EventMessage<?>> messageSource)
SubscribingEventProcessor
configuration based on this configure module.name
- of the processoreventHandlerInvoker
- used by the processor for the vent handlingmessageSource
- where to retrieve events fromSubscribingEventProcessor
configuration based on this configure module.protected EventProcessor trackingEventProcessor(String name, EventHandlerInvoker eventHandlerInvoker, TrackingEventProcessorConfiguration config, StreamableMessageSource<TrackedEventMessage<?>> source)
TrackingEventProcessor
configuration based on this configure module.name
- of the processoreventHandlerInvoker
- used by the processor for the event handlingconfig
- for the tracking event processor constructionsource
- where to retrieve events fromTrackingEventProcessor
configuration based on this configure module.protected EventProcessor pooledStreamingEventProcessor(String name, EventHandlerInvoker eventHandlerInvoker, Configuration config, StreamableMessageSource<TrackedEventMessage<?>> messageSource, EventProcessingConfigurer.PooledStreamingProcessorConfiguration processorConfiguration)
PooledStreamingEventProcessor
configuration based on this configure module.name
- of the processoreventHandlerInvoker
- used by the processor for the event handlingconfig
- main configuration providing access for Axon componentsmessageSource
- where to retrieve events fromprocessorConfiguration
- for the pooled event processor constructionPooledStreamingEventProcessor
configuration based on this configure module.Copyright © 2010–2024. All rights reserved.