public static class TrackingEventProcessor.Builder extends AbstractEventProcessor.Builder
TrackingEventProcessor.
The RollbackConfigurationType defaults to a RollbackConfigurationType.ANY_THROWABLE, the
ErrorHandler is defaulted to a PropagatingErrorHandler, the MessageMonitor defaults to a
NoOpMessageMonitor, the SpanFactory defaults to a
NoOpSpanFactory and the TrackingEventProcessorConfiguration to a
TrackingEventProcessorConfiguration.forSingleThreadedProcessing() call. The Event Processor name,
EventHandlerInvoker, StreamableMessageSource, TokenStore and TransactionManager
are
hard requirements and as such should be provided.
name| Constructor and Description |
|---|
Builder() |
| Modifier and Type | Method and Description |
|---|---|
TrackingEventProcessor |
build()
Initializes a
TrackingEventProcessor as specified through this Builder. |
TrackingEventProcessor.Builder |
errorHandler(ErrorHandler errorHandler)
Sets the
ErrorHandler invoked when an UnitOfWork is rolled back during processing. |
TrackingEventProcessor.Builder |
eventHandlerInvoker(EventHandlerInvoker eventHandlerInvoker)
Sets the
EventHandlerInvoker which will handle all the individual EventMessages. |
TrackingEventProcessor.Builder |
messageMonitor(MessageMonitor<? super EventMessage<?>> messageMonitor)
Sets the
MessageMonitor to monitor EventMessages before and after they're processed. |
TrackingEventProcessor.Builder |
messageSource(StreamableMessageSource<TrackedEventMessage<?>> messageSource)
Sets the
StreamableMessageSource (e.g. |
TrackingEventProcessor.Builder |
name(String name)
Sets the
name of this EventProcessor implementation. |
TrackingEventProcessor.Builder |
rollbackConfiguration(RollbackConfiguration rollbackConfiguration)
Sets the
RollbackConfiguration specifying the rollback behavior of the UnitOfWork while
processing a batch of events. |
TrackingEventProcessor.Builder |
spanFactory(SpanFactory spanFactory)
Sets the
SpanFactory implementation to use for providing tracing capabilities. |
TrackingEventProcessor.Builder |
storingTokensAfterProcessing()
Set this processor to store Tracking Tokens only at the end of processing.
|
TrackingEventProcessor.Builder |
tokenStore(TokenStore tokenStore)
Sets the
TokenStore used to store and fetch event tokens that enable this EventProcessor to
track its progress. |
TrackingEventProcessor.Builder |
trackingEventProcessorConfiguration(TrackingEventProcessorConfiguration trackingEventProcessorConfiguration)
Sets the
TrackingEventProcessorConfiguration containing the fine grained configuration options for a
TrackingEventProcessor. |
TrackingEventProcessor.Builder |
transactionManager(TransactionManager transactionManager)
Sets the
TransactionManager used when processing EventMessages. |
protected void |
validate()
Validates whether the fields contained in this Builder are set accordingly.
|
public TrackingEventProcessor.Builder name(@Nonnull String name)
AbstractEventProcessor.Buildername of this EventProcessor implementation.name in class AbstractEventProcessor.Buildername - a String defining this EventProcessor implementationpublic TrackingEventProcessor.Builder eventHandlerInvoker(@Nonnull EventHandlerInvoker eventHandlerInvoker)
AbstractEventProcessor.BuilderEventHandlerInvoker which will handle all the individual EventMessages.eventHandlerInvoker in class AbstractEventProcessor.BuildereventHandlerInvoker - the EventHandlerInvoker which will handle all the individual EventMessagespublic TrackingEventProcessor.Builder rollbackConfiguration(@Nonnull 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.BuilderrollbackConfiguration - the RollbackConfiguration specifying the rollback behavior of the UnitOfWork while processing a batch of events.public TrackingEventProcessor.Builder errorHandler(@Nonnull ErrorHandler errorHandler)
AbstractEventProcessor.BuilderErrorHandler invoked when an UnitOfWork is rolled back during processing. Defaults
to a PropagatingErrorHandler.errorHandler in class AbstractEventProcessor.BuildererrorHandler - the ErrorHandler invoked when an UnitOfWork is rolled back during
processingpublic TrackingEventProcessor.Builder messageMonitor(@Nonnull MessageMonitor<? super EventMessage<?>> messageMonitor)
AbstractEventProcessor.BuilderMessageMonitor to monitor EventMessages before and after they're processed. Defaults
to a NoOpMessageMonitor.messageMonitor in class AbstractEventProcessor.BuildermessageMonitor - a MessageMonitor to monitor EventMessages before and after they're
processedpublic TrackingEventProcessor.Builder spanFactory(@Nonnull SpanFactory spanFactory)
AbstractEventProcessor.BuilderSpanFactory implementation to use for providing tracing capabilities. Defaults to a
NoOpSpanFactory by default, which provides no tracing capabilities.spanFactory in class AbstractEventProcessor.BuilderspanFactory - The SpanFactory implementationpublic TrackingEventProcessor.Builder messageSource(StreamableMessageSource<TrackedEventMessage<?>> messageSource)
messageSource - the StreamableMessageSource (e.g. the EventBus) which this
EventProcessor will trackpublic TrackingEventProcessor.Builder tokenStore(TokenStore tokenStore)
TokenStore used to store and fetch event tokens that enable this EventProcessor to
track its progress.tokenStore - the TokenStore used to store and fetch event tokens that enable this EventProcessor to track its progresspublic TrackingEventProcessor.Builder transactionManager(TransactionManager transactionManager)
TransactionManager used when processing EventMessages.
Note that setting this value influences the behavior for storing tokens either at the start or at the end of
a batch. If a TransactionManager other than a NoTransactionManager is configured, the default
behavior is to store the last token of the Batch to the Token Store before processing of events begins. If
the NoTransactionManager is provided, the default is to extend the claim at the start of the unit of
work, and update the token after processing Events. When tokens are stored at the start of a batch, a claim
extension will be sent at the end of the batch if processing that batch took longer than the tokenClaimUpdateInterval.
Use storingTokensAfterProcessing() to force storage of tokens at the end of a batch.
transactionManager - the TransactionManager used when processing EventMessagesstoringTokensAfterProcessing()public TrackingEventProcessor.Builder trackingEventProcessorConfiguration(TrackingEventProcessorConfiguration trackingEventProcessorConfiguration)
TrackingEventProcessorConfiguration containing the fine grained configuration options for a
TrackingEventProcessor. Defaults to a TrackingEventProcessorConfiguration.forSingleThreadedProcessing()
call.trackingEventProcessorConfiguration - the TrackingEventProcessorConfiguration containing the
fine grained configuration options for a TrackingEventProcessorpublic TrackingEventProcessor.Builder storingTokensAfterProcessing()
Enable this when a Token Store cannot participate in a transaction, or when at-most-once-delivery semantics are desired.
The default behavior is to store the last token of the Batch to the Token Store before processing of events
begins, if a TransactionManager is configured. If the NoTransactionManager is provided, the default
is to extend the claim at the start of the unit of work, and update the token after processing Events. When
tokens are stored at the start of a batch, a claim extension will be sent at the end of the batch if
processing that batch took longer than the tokenClaimUpdateInterval.
public TrackingEventProcessor build()
TrackingEventProcessor as specified through this Builder.TrackingEventProcessor as specified through this Builderprotected void validate()
throws AxonConfigurationException
validate in class AbstractEventProcessor.BuilderAxonConfigurationException - if one field is asserted to be incorrect according to the Builder's
specificationsCopyright © 2010–2023. All rights reserved.