public class SubscribingEventProcessor extends AbstractEventProcessor
subscribes
to the EventBus
for
events. Events published on the event bus are supplied to this processor in the publishing thread.
Depending on the given EventProcessingStrategy
the events are processed directly (in the publishing thread)
or asynchronously.
Constructor and Description |
---|
SubscribingEventProcessor(String name,
EventHandlerInvoker eventHandlerInvoker,
RollbackConfiguration rollbackConfiguration,
SubscribableMessageSource<? extends EventMessage<?>> messageSource,
EventProcessingStrategy processingStrategy,
ErrorHandler errorHandler,
MessageMonitor<? super EventMessage<?>> messageMonitor)
Initializes an EventProcessor with given
name that subscribes to the given messageSource for
events. |
SubscribingEventProcessor(String name,
EventHandlerInvoker eventHandlerInvoker,
SubscribableMessageSource<? extends EventMessage<?>> messageSource,
EventProcessingStrategy processingStrategy,
ErrorHandler errorHandler,
MessageMonitor<? super EventMessage<?>> messageMonitor)
Initializes an EventProcessor with given
name that subscribes to the given messageSource for
events. |
SubscribingEventProcessor(String name,
EventHandlerInvoker eventHandlerInvoker,
SubscribableMessageSource<EventMessage<?>> messageSource)
Initializes an EventProcessor with given
name that subscribes to the given messageSource for
events. |
SubscribingEventProcessor(String name,
EventHandlerInvoker eventHandlerInvoker,
SubscribableMessageSource<EventMessage<?>> messageSource,
EventProcessingStrategy processingStrategy,
ErrorHandler errorHandler)
Initializes an EventProcessor with given
name that subscribes to the given messageSource for
events. |
Modifier and Type | Method and Description |
---|---|
protected void |
process(List<? extends EventMessage<?>> eventMessages)
Process the given messages.
|
void |
shutDown()
Shut down this processor.
|
void |
start()
Start this processor.
|
canHandle, eventHandlerInvoker, getName, processInUnitOfWork, registerInterceptor, reportIgnored, toString
public SubscribingEventProcessor(String name, EventHandlerInvoker eventHandlerInvoker, SubscribableMessageSource<EventMessage<?>> messageSource)
name
that subscribes to the given messageSource
for
events. Actual handling of event messages is deferred to the given eventHandlerInvoker
.
The EventProcessor is initialized with a DirectEventProcessingStrategy
, a PropagatingErrorHandler
and a
RollbackConfigurationType.ANY_THROWABLE
.
name
- The name of the event processoreventHandlerInvoker
- The component that handles the individual eventsmessageSource
- The EventBus to which this event processor will subscribepublic SubscribingEventProcessor(String name, EventHandlerInvoker eventHandlerInvoker, SubscribableMessageSource<EventMessage<?>> messageSource, EventProcessingStrategy processingStrategy, ErrorHandler errorHandler)
name
that subscribes to the given messageSource
for
events. Actual handling of event messages is deferred to the given eventHandlerInvoker
.
The EventProcessor is initialized with a DirectEventProcessingStrategy
, a PropagatingErrorHandler
and a
RollbackConfigurationType.ANY_THROWABLE
.
name
- The name of the event processoreventHandlerInvoker
- The component that handles the individual eventsmessageSource
- The EventBus to which this event processor will subscribeprocessingStrategy
- Strategy that determines whether events are processed directly or asynchronouslyerrorHandler
- The handler to invoke when an error occurs in the processorpublic SubscribingEventProcessor(String name, EventHandlerInvoker eventHandlerInvoker, SubscribableMessageSource<? extends EventMessage<?>> messageSource, EventProcessingStrategy processingStrategy, ErrorHandler errorHandler, MessageMonitor<? super EventMessage<?>> messageMonitor)
name
that subscribes to the given messageSource
for
events. Actual handling of event messages is deferred to the given eventHandlerInvoker
.
The EventProcessor is initialized with a DirectEventProcessingStrategy
, a PropagatingErrorHandler
and a
RollbackConfigurationType.ANY_THROWABLE
.
name
- The name of the event processoreventHandlerInvoker
- The component that handles the individual eventsmessageSource
- The EventBus to which this event processor will subscribeprocessingStrategy
- Strategy that determines whether events are processed directly or asynchronouslyerrorHandler
- The handler to invoke when an error occurs in the processormessageMonitor
- Monitor to be invoked before and after event processingpublic SubscribingEventProcessor(String name, EventHandlerInvoker eventHandlerInvoker, RollbackConfiguration rollbackConfiguration, SubscribableMessageSource<? extends EventMessage<?>> messageSource, EventProcessingStrategy processingStrategy, ErrorHandler errorHandler, MessageMonitor<? super EventMessage<?>> messageMonitor)
name
that subscribes to the given messageSource
for
events. Actual handling of event messages is deferred to the given eventHandlerInvoker
.name
- The name of the event processoreventHandlerInvoker
- The component that handles the individual eventsrollbackConfiguration
- Determines rollback behavior of the UnitOfWork while processing a batch of eventsmessageSource
- The EventBus to which this event processor will subscribeprocessingStrategy
- Strategy that determines whether events are processed directly or asynchronouslyerrorHandler
- Invoked when a UnitOfWork is rolled back during processingmessageMonitor
- Monitor to be invoked before and after event processingpublic void start()
EventBus
.protected void process(List<? extends EventMessage<?>> eventMessages)
This implementation creates a Batching unit of work for the given batch of eventMessages
.
eventMessages
- The messages to processpublic void shutDown()
EventBus
.Copyright © 2010–2018. All rights reserved.