Package org.axonframework.eventhandling
Class SubscribingEventProcessor.Builder
java.lang.Object
org.axonframework.eventhandling.AbstractEventProcessor.Builder
org.axonframework.eventhandling.SubscribingEventProcessor.Builder
- Enclosing class:
SubscribingEventProcessor
Builder class to instantiate a
SubscribingEventProcessor.
The RollbackConfigurationType defaults to a RollbackConfigurationType.ANY_THROWABLE, the
ErrorHandler is defaulted to a PropagatingErrorHandler, the MessageMonitor defaults to a
EventProcessorSpanFactory is defaulted to a DefaultEventProcessorSpanFactory backed by a
NoOpSpanFactory, the MessageMonitor defaults to a
NoOpMessageMonitor, the EventProcessingStrategy defaults to a
DirectEventProcessingStrategy and the TransactionManager defaults to the
NoTransactionManager.INSTANCE. The Event Processor name, EventHandlerInvoker and
SubscribableMessageSource are hard requirements and as such should be provided.
-
Field Summary
Fields inherited from class org.axonframework.eventhandling.AbstractEventProcessor.Builder
name -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbuild()Initializes aSubscribingEventProcessoras specified through this Builder.errorHandler(ErrorHandler errorHandler) Sets theErrorHandlerinvoked when anUnitOfWorkis rolled back during processing.eventHandlerInvoker(EventHandlerInvoker eventHandlerInvoker) Sets theEventHandlerInvokerwhich will handle all the individualEventMessages.messageMonitor(MessageMonitor<? super EventMessage<?>> messageMonitor) Sets theMessageMonitorto monitorEventMessages before and after they're processed.messageSource(SubscribableMessageSource<? extends EventMessage<?>> messageSource) Sets theSubscribableMessageSource(e.g. theEventBus) to which thisEventProcessorimplementation will subscribe itself to receiveEventMessages.Sets thenameof thisEventProcessorimplementation.processingStrategy(EventProcessingStrategy processingStrategy) Sets theEventProcessingStrategydetermining whether events are processed directly or asynchronously.rollbackConfiguration(RollbackConfiguration rollbackConfiguration) Sets theRollbackConfigurationspecifying the rollback behavior of theUnitOfWorkwhile processing a batch of events.spanFactory(EventProcessorSpanFactory spanFactory) Sets theEventProcessorSpanFactoryimplementation to use for providing tracing capabilities.spanFactory(SpanFactory spanFactory) Deprecated.transactionManager(TransactionManager transactionManager) Sets theTransactionManagerused when processingEventMessages.protected voidvalidate()Validates whether the fields contained in this Builder are set accordingly.
-
Constructor Details
-
Builder
public Builder()
-
-
Method Details
-
name
Description copied from class:AbstractEventProcessor.BuilderSets thenameof thisEventProcessorimplementation.- Overrides:
namein classAbstractEventProcessor.Builder- Parameters:
name- aStringdefining thisEventProcessorimplementation- Returns:
- the current Builder instance, for fluent interfacing
-
eventHandlerInvoker
public SubscribingEventProcessor.Builder eventHandlerInvoker(@Nonnull EventHandlerInvoker eventHandlerInvoker) Description copied from class:AbstractEventProcessor.BuilderSets theEventHandlerInvokerwhich will handle all the individualEventMessages.- Overrides:
eventHandlerInvokerin classAbstractEventProcessor.Builder- Parameters:
eventHandlerInvoker- theEventHandlerInvokerwhich will handle all the individualEventMessages- Returns:
- the current Builder instance, for fluent interfacing
-
rollbackConfiguration
public SubscribingEventProcessor.Builder rollbackConfiguration(@Nonnull RollbackConfiguration rollbackConfiguration) Sets theRollbackConfigurationspecifying the rollback behavior of theUnitOfWorkwhile processing a batch of events.. Defaults to aRollbackConfigurationType.ANY_THROWABLE)- Overrides:
rollbackConfigurationin classAbstractEventProcessor.Builder- Parameters:
rollbackConfiguration- theRollbackConfigurationspecifying the rollback behavior of theUnitOfWorkwhile processing a batch of events.- Returns:
- the current Builder instance, for fluent interfacing
-
errorHandler
Description copied from class:AbstractEventProcessor.BuilderSets theErrorHandlerinvoked when anUnitOfWorkis rolled back during processing. Defaults to aPropagatingErrorHandler.- Overrides:
errorHandlerin classAbstractEventProcessor.Builder- Parameters:
errorHandler- theErrorHandlerinvoked when anUnitOfWorkis rolled back during processing- Returns:
- the current Builder instance, for fluent interfacing
-
messageMonitor
public SubscribingEventProcessor.Builder messageMonitor(@Nonnull MessageMonitor<? super EventMessage<?>> messageMonitor) Description copied from class:AbstractEventProcessor.BuilderSets theMessageMonitorto monitorEventMessages before and after they're processed. Defaults to aNoOpMessageMonitor.- Overrides:
messageMonitorin classAbstractEventProcessor.Builder- Parameters:
messageMonitor- aMessageMonitorto monitorEventMessages before and after they're processed- Returns:
- the current Builder instance, for fluent interfacing
-
spanFactory
public SubscribingEventProcessor.Builder spanFactory(@Nonnull EventProcessorSpanFactory spanFactory) Description copied from class:AbstractEventProcessor.BuilderSets theEventProcessorSpanFactoryimplementation to use for providing tracing capabilities. Defaults to aDefaultEventProcessorSpanFactorybacked by aNoOpSpanFactoryby default, which provides no tracing capabilities.- Overrides:
spanFactoryin classAbstractEventProcessor.Builder- Parameters:
spanFactory- TheSpanFactoryimplementation- Returns:
- The current Builder instance, for fluent interfacing.
-
spanFactory
Deprecated.Description copied from class:AbstractEventProcessor.BuilderSets theSpanFactoryimplementation to use for providing tracing capabilities. Defaults to aNoOpSpanFactoryby default, which provides no tracing capabilities.- Overrides:
spanFactoryin classAbstractEventProcessor.Builder- Parameters:
spanFactory- TheSpanFactoryimplementation- Returns:
- The current Builder instance, for fluent interfacing.
-
messageSource
public SubscribingEventProcessor.Builder messageSource(@Nonnull SubscribableMessageSource<? extends EventMessage<?>> messageSource) Sets theSubscribableMessageSource(e.g. theEventBus) to which thisEventProcessorimplementation will subscribe itself to receiveEventMessages.- Parameters:
messageSource- theSubscribableMessageSource(e.g. theEventBus) to which thisEventProcessorimplementation will subscribe itself to receiveEventMessages- Returns:
- the current Builder instance, for fluent interfacing
-
processingStrategy
public SubscribingEventProcessor.Builder processingStrategy(@Nonnull EventProcessingStrategy processingStrategy) Sets theEventProcessingStrategydetermining whether events are processed directly or asynchronously. Defaults to aDirectEventProcessingStrategy.- Parameters:
processingStrategy- theEventProcessingStrategydetermining whether events are processed directly or asynchronously- Returns:
- the current Builder instance, for fluent interfacing
-
transactionManager
public SubscribingEventProcessor.Builder transactionManager(@Nonnull TransactionManager transactionManager) Sets theTransactionManagerused when processingEventMessages.- Parameters:
transactionManager- theTransactionManagerused when processingEventMessages- Returns:
- the current Builder instance, for fluent interfacing
-
build
Initializes aSubscribingEventProcessoras specified through this Builder.- Returns:
- a
SubscribingEventProcessoras specified through this Builder
-
validate
Validates whether the fields contained in this Builder are set accordingly.- Overrides:
validatein classAbstractEventProcessor.Builder- Throws:
AxonConfigurationException- if one field is asserted to be incorrect according to the Builder's specifications
-