Class SubscribingEventProcessorConfiguration
- All Implemented Interfaces:
DescribableComponent
SubscribingEventProcessor.
ErrorHandler is defaulted to a PropagatingErrorHandler and the UnitOfWorkFactory defaults to
the SimpleUnitOfWorkFactory. The Event Processor SubscribableEventSource is hard requirements
and as such should be provided.
- Since:
- 5.0.0
- Author:
- Mateusz Nowak
-
Field Summary
Fields inherited from class org.axonframework.messaging.eventhandling.configuration.EventProcessorConfiguration
errorHandler, interceptors, messageMonitor, unitOfWorkFactory -
Constructor Summary
ConstructorsConstructorDescriptionConstructs a newSubscribingEventProcessorConfiguration.Constructs a newSubscribingEventProcessorConfigurationcopying properties from the given configuration.SubscribingEventProcessorConfiguration(EventProcessorConfiguration base, Configuration configuration) Constructs a newSubscribingEventProcessorConfigurationwith default values and retrieve global default values. -
Method Summary
Modifier and TypeMethodDescriptionvoiddescribeTo(ComponentDescriptor descriptor) Describe the properties ofthis DescribableComponentwith the givendescriptor.errorHandler(ErrorHandler errorHandler) Sets theErrorHandlerinvoked when anUnitOfWorkthrows an exception during processing.Returns theSubscribableEventSourceto which this processor subscribes.eventSource(SubscribableEventSource eventSource) Sets theSubscribableEventSource(e.g. theEventBus) to which thisEventProcessorimplementation will subscribe itself to receiveEventMessages.Consumer<? super EventMessage> Returns the handler for ignored messages.ignoredMessageHandler(Consumer<? super EventMessage> ignoredMessageHandler) Sets the handler, that is invoked when the event is ignored by allEventHandlingComponentsthisSubscribingEventProcessorcontrols.unitOfWorkFactory(UnitOfWorkFactory unitOfWorkFactory) AUnitOfWorkFactorythat spawnsUnitOfWorkused to process an event batch.protected voidvalidate()Validates whether the fields contained in this Builder are set accordingly.withInterceptor(MessageHandlerInterceptor<? super EventMessage> interceptor) Registers the givenEventMessage-specificMessageHandlerInterceptorfor theSubscribingEventProcessorunder construction.Methods inherited from class org.axonframework.messaging.eventhandling.configuration.EventProcessorConfiguration
errorHandler, interceptors, streaming, unitOfWorkFactory
-
Constructor Details
-
SubscribingEventProcessorConfiguration
Constructs a newSubscribingEventProcessorConfiguration.This configuration will not have any of the default
MessageHandlerInterceptorsfor events. Please useSubscribingEventProcessorConfiguration(EventProcessorConfiguration, Configuration)when those are desired. -
SubscribingEventProcessorConfiguration
Constructs a newSubscribingEventProcessorConfigurationcopying properties from the given configuration.- Parameters:
base- TheEventProcessorConfigurationto copy properties from.
-
SubscribingEventProcessorConfiguration
@Internal public SubscribingEventProcessorConfiguration(@Nonnull EventProcessorConfiguration base, @Nonnull Configuration configuration) Constructs a newSubscribingEventProcessorConfigurationwith default values and retrieve global default values.- Parameters:
configuration- The configuration, used to retrieve global default values, likeMessageHandlerInterceptors, from.
-
-
Method Details
-
errorHandler
Description copied from class:EventProcessorConfigurationSets theErrorHandlerinvoked when anUnitOfWorkthrows an exception during processing. Defaults to aPropagatingErrorHandler.- Overrides:
errorHandlerin classEventProcessorConfiguration- Parameters:
errorHandler- theErrorHandlerinvoked when anUnitOfWorkthrows an exception during processing- Returns:
- The current instance, for fluent interfacing.
-
eventSource
public SubscribingEventProcessorConfiguration eventSource(@Nonnull SubscribableEventSource eventSource) Sets theSubscribableEventSource(e.g. theEventBus) to which thisEventProcessorimplementation will subscribe itself to receiveEventMessages.- Parameters:
eventSource- TheSubscribableEventSource(e.g. theEventBus) to which thisEventProcessorimplementation will subscribe itself to receiveEventMessages.- Returns:
- The current instance, for fluent interfacing.
-
ignoredMessageHandler
public SubscribingEventProcessorConfiguration ignoredMessageHandler(Consumer<? super EventMessage> ignoredMessageHandler) Sets the handler, that is invoked when the event is ignored by allEventHandlingComponentsthisSubscribingEventProcessorcontrols. Defaults to a no-op.- Parameters:
ignoredMessageHandler- The handler, that is invoked when the event is ignored by allEventHandlingComponentsthisSubscribingEventProcessor}} controls.invalid @link
{@link {@link- Returns:
- The current Builder instance, for fluent interfacing.
-
unitOfWorkFactory
public SubscribingEventProcessorConfiguration unitOfWorkFactory(@Nonnull UnitOfWorkFactory unitOfWorkFactory) Description copied from class:EventProcessorConfigurationAUnitOfWorkFactorythat spawnsUnitOfWorkused to process an event batch.- Overrides:
unitOfWorkFactoryin classEventProcessorConfiguration- Parameters:
unitOfWorkFactory- AUnitOfWorkFactorythat spawnsUnitOfWork.- Returns:
- The current instance, for fluent interfacing.
-
withInterceptor
@Nonnull public SubscribingEventProcessorConfiguration withInterceptor(@Nonnull MessageHandlerInterceptor<? super EventMessage> interceptor) Registers the givenEventMessage-specificMessageHandlerInterceptorfor theSubscribingEventProcessorunder construction.- Parameters:
interceptor- TheEventMessage-specificMessageHandlerInterceptorto register for theSubscribingEventProcessorunder construction.- Returns:
- This
SubscribingEventProcessorConfiguration, for fluent interfacing.
-
validate
Validates whether the fields contained in this Builder are set accordingly.- Overrides:
validatein classEventProcessorConfiguration- Throws:
AxonConfigurationException- if one field is asserted to be incorrect according to the Builder's specifications.
-
eventSource
Returns theSubscribableEventSourceto which this processor subscribes.- Returns:
- The
SubscribableEventSourcefor receiving events.
-
ignoredMessageHandler
Returns the handler for ignored messages.- Returns:
- The ignored message handler.
-
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- Overrides:
describeToin classEventProcessorConfiguration- Parameters:
descriptor- The component descriptor to describethis DescribableComponentn its properties in.
-