Class EventProcessorConfiguration

java.lang.Object
org.axonframework.messaging.eventhandling.configuration.EventProcessorConfiguration
All Implemented Interfaces:
DescribableComponent
Direct Known Subclasses:
PooledStreamingEventProcessorConfiguration, SubscribingEventProcessorConfiguration

public class EventProcessorConfiguration extends Object implements DescribableComponent
Configuration class to be used for EventProcessor implementations.

The ErrorHandler is defaulted to a PropagatingErrorHandler and the UnitOfWorkFactory defaults to the SimpleUnitOfWorkFactory

Since:
5.0.0
Author:
Mateusz Nowak
  • Field Details

  • Constructor Details

  • Method Details

    • errorHandler

      public EventProcessorConfiguration errorHandler(ErrorHandler errorHandler)
      Sets the ErrorHandler invoked when an UnitOfWork throws an exception during processing. Defaults to a PropagatingErrorHandler.
      Parameters:
      errorHandler - the ErrorHandler invoked when an UnitOfWork throws an exception during processing
      Returns:
      The current instance, for fluent interfacing.
    • unitOfWorkFactory

      public EventProcessorConfiguration unitOfWorkFactory(UnitOfWorkFactory unitOfWorkFactory)
      A UnitOfWorkFactory that spawns UnitOfWork used to process an event batch.
      Parameters:
      unitOfWorkFactory - A UnitOfWorkFactory that spawns UnitOfWork.
      Returns:
      The current instance, for fluent interfacing.
    • validate

      protected void validate() throws AxonConfigurationException
      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

      public ErrorHandler errorHandler()
      Returns the ErrorHandler invoked when an UnitOfWork throws an exception during processing.
      Returns:
      The ErrorHandler for this EventProcessor implementation.
    • unitOfWorkFactory

      public UnitOfWorkFactory unitOfWorkFactory()
      Returns the UnitOfWorkFactory used to create UnitOfWork instances for event processing.
      Returns:
      The UnitOfWorkFactory for this EventProcessor implementation.
    • streaming

      public boolean streaming()
      Returns whether this configuration is for a streaming event processor.
      Returns:
      false for basic configuration, true for streaming configurations.
    • describeTo

      public void describeTo(ComponentDescriptor descriptor)
      Description copied from interface: DescribableComponent
      Describe the properties of this DescribableComponent with the given descriptor.

      Components should call the appropriate describeProperty methods 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 DescribableComponent implementation 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 the describeTo method, 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:
      describeTo in interface DescribableComponent
      Parameters:
      descriptor - The component descriptor to describe this DescribableComponentn its properties in.