Class EventProcessorConfiguration
- All Implemented Interfaces:
DescribableComponent
- Direct Known Subclasses:
PooledStreamingEventProcessorConfiguration,SubscribingEventProcessorConfiguration
EventProcessor implementations.
The ErrorHandler is defaulted to a PropagatingErrorHandler and the UnitOfWorkFactory defaults
to the SimpleUnitOfWorkFactory
- Since:
- 5.0.0
- Author:
- Mateusz Nowak
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected ErrorHandlerprotected BiFunction<Class<? extends EventProcessor>, String, List<MessageHandlerInterceptor<? super EventMessage>>> protected List<MessageHandlerInterceptor<? super EventMessage>> protected BiFunction<Class<? extends EventProcessor>, String, MessageMonitor<? super EventMessage>> protected final Stringprotected UnitOfWorkFactory -
Constructor Summary
ConstructorsConstructorDescriptionEventProcessorConfiguration(String processorName, @Nullable Configuration config) Constructs a newEventProcessorConfigurationwith default values and retrieve global default values.Constructs a newEventProcessorConfigurationcopying properties from the given configuration. -
Method Summary
Modifier and TypeMethodDescriptionvoiddescribeTo(ComponentDescriptor descriptor) Describe the properties ofthis DescribableComponentwith the givendescriptor.Returns theErrorHandlerinvoked when anUnitOfWorkthrows an exception during processing.errorHandler(ErrorHandler errorHandler) Sets theErrorHandlerinvoked when anUnitOfWorkthrows an exception during processing.booleanReturns whether this configuration is for a streaming event processor.Returns theUnitOfWorkFactoryused to createUnitOfWorkinstances for event processing.unitOfWorkFactory(UnitOfWorkFactory unitOfWorkFactory) AUnitOfWorkFactorythat spawnsUnitOfWorkused to process an event batch.protected voidvalidate()Validates whether the fields contained in this Builder are set accordingly.
-
Field Details
-
processorName
-
errorHandler
-
unitOfWorkFactory
-
interceptors
-
interceptorBuilder
protected BiFunction<Class<? extends EventProcessor>,String, interceptorBuilderList<MessageHandlerInterceptor<? super EventMessage>>> -
monitorBuilder
protected BiFunction<Class<? extends EventProcessor>,String, monitorBuilderMessageMonitor<? super EventMessage>>
-
-
Constructor Details
-
EventProcessorConfiguration
Constructs a newEventProcessorConfigurationwith default values and retrieve global default values.When the given
configisnull, theMessageHandlerInterceptorsandMessageMonitorwill not be retrieved from theHandlerInterceptorRegistryandMessageMonitorRegistryrespectively.- Parameters:
processorName- the name of the processor this configuration is forconfig- the config, used to retrieve global default values, likeMessageHandlerInterceptors, from
-
EventProcessorConfiguration
Constructs a newEventProcessorConfigurationcopying properties from the given configuration.- Parameters:
base- theEventProcessorConfigurationto copy properties from
-
-
Method Details
-
errorHandler
Sets theErrorHandlerinvoked when anUnitOfWorkthrows an exception during processing. Defaults to aPropagatingErrorHandler.- Parameters:
errorHandler- theErrorHandlerinvoked when anUnitOfWorkthrows an exception during processing- Returns:
- The current instance, for fluent interfacing.
-
unitOfWorkFactory
AUnitOfWorkFactorythat spawnsUnitOfWorkused to process an event batch.- Parameters:
unitOfWorkFactory- AUnitOfWorkFactorythat spawnsUnitOfWork.- Returns:
- The current instance, for fluent interfacing.
-
validate
Validates whether the fields contained in this Builder are set accordingly.- Throws:
AxonConfigurationException- if one field is asserted to be incorrect according to the Builder's specifications
-
errorHandler
Returns theErrorHandlerinvoked when anUnitOfWorkthrows an exception during processing.- Returns:
- The
ErrorHandlerfor thisEventProcessorimplementation.
-
unitOfWorkFactory
Returns theUnitOfWorkFactoryused to createUnitOfWorkinstances for event processing.- Returns:
- The
UnitOfWorkFactoryfor thisEventProcessorimplementation.
-
streaming
public boolean streaming()Returns whether this configuration is for a streaming event processor.- Returns:
falsefor basic configuration,truefor streaming configurations.
-
describeTo
Description copied from interface:DescribableComponentDescribe the properties ofthis DescribableComponentwith the givendescriptor.Components should call the appropriate
describePropertymethods on the descriptor to register their properties. The descriptor is responsible for determining how these properties are formatted and structured in the final output.Best Practices: As a general rule, all relevant fields of a
DescribableComponentimplementation should be described in this method. However, developers have discretion to include only the fields that make sense in the context. Not every field may be meaningful for description purposes, especially internal implementation details. Furthermore, components might want to expose different information based on their current state. The final decision on what properties to include lies with the person implementing thedescribeTomethod, who should focus on providing information that is useful for understanding the component's configuration and state.Example implementation:
public void describeTo(ComponentDescriptor descriptor) { descriptor.describeProperty("name", this.name); descriptor.describeProperty("enabled", this.enabled); descriptor.describeProperty("configuration", this.configuration); // A nested component descriptor.describeProperty("handlers", this.eventHandlers); // A collection }- Specified by:
describeToin interfaceDescribableComponent- Parameters:
descriptor- The component descriptor to describethis DescribableComponentn its properties in.
-