Class ProcessorEventHandlingComponents

java.lang.Object
org.axonframework.messaging.eventhandling.processing.ProcessorEventHandlingComponents

@Internal public class ProcessorEventHandlingComponents extends Object
Internal class for managing multiple EventHandlingComponent instances and processing event messages through them. Each event handling component is wrapped in a SequencingEventHandlingComponent to ensure proper sequencing where required.

Key responsibilities include:

  • Distributing event messages to the associated EventHandlingComponent instances.
  • Ensuring event handling sequencing policies are respected when applicable.
  • Determining support for specific event types across the managed components.
Since:
5.0.0
Author:
Mateusz Nowak
  • Constructor Details

    • ProcessorEventHandlingComponents

      public ProcessorEventHandlingComponents(@Nonnull List<EventHandlingComponent> components)
      Constructs a ProcessorEventHandlingComponents instance by wrapping the provided list of EventHandlingComponents in SequencingEventHandlingComponent instances for sequential event handling where needed.
      Parameters:
      components - The list of EventHandlingComponents to be used for event processing. Must not be null and is transformed into a list of SequencingEventHandlingComponents if necessary.
  • Method Details

    • handle

      @Nonnull public MessageStream.Empty<Message> handle(@Nonnull List<? extends EventMessage> events, @Nonnull ProcessingContext context)
      Processes a batch of events in the processing context.

      The result of handling is an empty stream. It's guaranteed that the events with same sequenceIdentifiersFor(EventMessage, ProcessingContext) value are processed by a single component in the order they are received, but the sequencing of event processing is not preserved between different event handling components. This is intentional, as they may have different sequencing policies.

      Parameters:
      events - The batch of event messages to be processed.
      context - The processing context in which the event messages are processed.
      Returns:
      A stream of messages resulting from the processing of the event messages.
    • supportedEvents

      public Set<QualifiedName> supportedEvents()
      Retrieves a set of all event names supported by the components comprising this ProcessorEventHandlingComponents instance. Each event is referenced through a QualifiedName.
      Returns:
      A set of QualifiedName objects representing the supported events.
    • supports

      public boolean supports(@Nonnull QualifiedName eventName)
      Checks if the specified event name is supported by any of the components.
      Parameters:
      eventName - The qualified name of the event to be checked. Must not be null.
      Returns:
      true if the event name is supported, false otherwise.
    • sequenceIdentifiersFor

      public Set<Object> sequenceIdentifiersFor(@Nonnull EventMessage event, @Nonnull ProcessingContext context)
      Retrieves a set of sequence identifiers for the given event message and processing context. Each identifier represents a sequence property determined by the components within this instance.
      Parameters:
      event - The event message for which the sequence identifiers are to be determined. Must not be null.
      context - The processing context in which the sequence identifiers are evaluated. Must not be null.
      Returns:
      A set of sequence identifiers associated with the given event and context.