public static class SubscribingEventProcessor.Builder extends AbstractEventProcessor.Builder
SubscribingEventProcessor
.
The RollbackConfigurationType
defaults to a RollbackConfigurationType.ANY_THROWABLE
, the
ErrorHandler
is defaulted to a PropagatingErrorHandler
, the MessageMonitor
defaults to a
NoOpMessageMonitor
and the EventProcessingStrategy
defaults to a
DirectEventProcessingStrategy
. The Event Processor name
, EventHandlerInvoker
and
SubscribableMessageSource
are hard requirements and as such should be provided.
name
Constructor and Description |
---|
Builder() |
Modifier and Type | Method and Description |
---|---|
SubscribingEventProcessor |
build()
Initializes a
SubscribingEventProcessor as specified through this Builder. |
SubscribingEventProcessor.Builder |
errorHandler(ErrorHandler errorHandler)
Sets the
ErrorHandler invoked when an UnitOfWork is rolled back during processing. |
SubscribingEventProcessor.Builder |
eventHandlerInvoker(EventHandlerInvoker eventHandlerInvoker)
Sets the
EventHandlerInvoker which will handle all the individual EventMessage s. |
SubscribingEventProcessor.Builder |
messageMonitor(MessageMonitor<? super EventMessage<?>> messageMonitor)
Sets the
MessageMonitor to monitor EventMessage s before and after they're processed. |
SubscribingEventProcessor.Builder |
messageSource(SubscribableMessageSource<? extends EventMessage<?>> messageSource)
Sets the
SubscribableMessageSource (e.g. |
SubscribingEventProcessor.Builder |
name(String name)
Sets the
name of this EventProcessor implementation. |
SubscribingEventProcessor.Builder |
processingStrategy(EventProcessingStrategy processingStrategy)
Sets the
EventProcessingStrategy determining whether events are processed directly or asynchronously. |
SubscribingEventProcessor.Builder |
rollbackConfiguration(RollbackConfiguration rollbackConfiguration)
Sets the
RollbackConfiguration specifying the rollback behavior of the UnitOfWork while
processing a batch of events. |
protected void |
validate()
Validates whether the fields contained in this Builder are set accordingly.
|
public SubscribingEventProcessor.Builder name(String name)
AbstractEventProcessor.Builder
name
of this EventProcessor
implementation.name
in class AbstractEventProcessor.Builder
name
- a String
defining this EventProcessor
implementationpublic SubscribingEventProcessor.Builder eventHandlerInvoker(EventHandlerInvoker eventHandlerInvoker)
AbstractEventProcessor.Builder
EventHandlerInvoker
which will handle all the individual EventMessage
s.eventHandlerInvoker
in class AbstractEventProcessor.Builder
eventHandlerInvoker
- the EventHandlerInvoker
which will handle all the individual
EventMessage
spublic SubscribingEventProcessor.Builder rollbackConfiguration(RollbackConfiguration rollbackConfiguration)
RollbackConfiguration
specifying the rollback behavior of the UnitOfWork
while
processing a batch of events.. Defaults to a RollbackConfigurationType.ANY_THROWABLE
)rollbackConfiguration
in class AbstractEventProcessor.Builder
rollbackConfiguration
- the RollbackConfiguration
specifying the rollback behavior of the
UnitOfWork
while processing a batch of events.public SubscribingEventProcessor.Builder errorHandler(ErrorHandler errorHandler)
AbstractEventProcessor.Builder
ErrorHandler
invoked when an UnitOfWork
is rolled back during processing. Defaults
to a PropagatingErrorHandler
.errorHandler
in class AbstractEventProcessor.Builder
errorHandler
- the ErrorHandler
invoked when an UnitOfWork
is rolled back during
processingpublic SubscribingEventProcessor.Builder messageMonitor(MessageMonitor<? super EventMessage<?>> messageMonitor)
AbstractEventProcessor.Builder
MessageMonitor
to monitor EventMessage
s before and after they're processed. Defaults
to a NoOpMessageMonitor
.messageMonitor
in class AbstractEventProcessor.Builder
messageMonitor
- a MessageMonitor
to monitor EventMessage
s before and after they're
processedpublic SubscribingEventProcessor.Builder messageSource(SubscribableMessageSource<? extends EventMessage<?>> messageSource)
SubscribableMessageSource
(e.g. the EventBus
) to which this EventProcessor
implementation will subscribe itself to receive EventMessage
s.messageSource
- the SubscribableMessageSource
(e.g. the EventBus
) to which this
EventProcessor
implementation will subscribe itself to receive
EventMessage
spublic SubscribingEventProcessor.Builder processingStrategy(EventProcessingStrategy processingStrategy)
EventProcessingStrategy
determining whether events are processed directly or asynchronously.
Defaults to a DirectEventProcessingStrategy
.processingStrategy
- the EventProcessingStrategy
determining whether events are processed
directly or asynchronouslypublic SubscribingEventProcessor build()
SubscribingEventProcessor
as specified through this Builder.SubscribingEventProcessor
as specified through this Builderprotected void validate() throws AxonConfigurationException
validate
in class AbstractEventProcessor.Builder
AxonConfigurationException
- if one field is asserted to be incorrect according to the Builder's
specificationsCopyright © 2010–2018. All rights reserved.