Class MultiEventHandlerInvoker

java.lang.Object
org.axonframework.eventhandling.MultiEventHandlerInvoker
All Implemented Interfaces:
EventHandlerInvoker

public class MultiEventHandlerInvoker extends Object implements EventHandlerInvoker
Implementation of EventHandlerInvoker with capabilities to invoke several different invokers.
Since:
3.3
Author:
Milan Savic
  • Constructor Details

    • MultiEventHandlerInvoker

      public MultiEventHandlerInvoker(EventHandlerInvoker... delegates)
      Initializes multi invoker with different invokers. Invokers of instance MultiEventHandlerInvoker will be flattened.
      Parameters:
      delegates - which will be used to do the actual event handling
    • MultiEventHandlerInvoker

      public MultiEventHandlerInvoker(@Nonnull List<EventHandlerInvoker> delegates)
      Initializes multi invoker with different invokers. Invokers of instance MultiEventHandlerInvoker will be flattened.
      Parameters:
      delegates - which will be used to do the actual event handling
  • Method Details

    • delegates

      @Nonnull public List<EventHandlerInvoker> delegates()
    • canHandle

      public boolean canHandle(@Nonnull EventMessage<?> eventMessage, @Nonnull Segment segment)
      Description copied from interface: EventHandlerInvoker
      Check whether or not this invoker has handlers that can handle the given eventMessage for a given segment.
      Specified by:
      canHandle in interface EventHandlerInvoker
      Parameters:
      eventMessage - The message to be processed
      segment - The segment for which the event handler should be invoked
      Returns:
      true if the invoker has one or more handlers that can handle the given message, false otherwise
    • canHandleType

      public boolean canHandleType(@Nonnull Class<?> payloadType)
      Description copied from interface: EventHandlerInvoker
      Check whether or not this invoker has handlers that can handle the given payloadType.
      Specified by:
      canHandleType in interface EventHandlerInvoker
      Parameters:
      payloadType - The payloadType of the message to be processed
      Returns:
      true if the invoker has one or more handlers that can handle the given message, false otherwise
    • handle

      public void handle(@Nonnull EventMessage<?> message, @Nonnull Segment segment) throws Exception
      Description copied from interface: EventHandlerInvoker
      Handle the given message for the given segment.

      Callers are recommended to invoke EventHandlerInvoker.canHandle(EventMessage, Segment) prior to invocation, but aren't required to do so. Implementations must ensure to take the given segment into account when processing messages.

      Specified by:
      handle in interface EventHandlerInvoker
      Parameters:
      message - The message to handle
      segment - The segment for which to handle the message
      Throws:
      Exception - when an exception occurs while handling the message
    • supportsReset

      public boolean supportsReset()
      Description copied from interface: EventHandlerInvoker
      Indicates whether the handlers managed by this invoker support a reset.
      Specified by:
      supportsReset in interface EventHandlerInvoker
      Returns:
      true if a reset is supported, otherwise false
    • performReset

      public void performReset()
      Description copied from interface: EventHandlerInvoker
      Performs any activities that are required to reset the state managed by handlers assigned to this invoker.
      Specified by:
      performReset in interface EventHandlerInvoker
    • performReset

      public <R> void performReset(R resetContext)
      Description copied from interface: EventHandlerInvoker
      Performs any activities that are required to reset the state managed by handlers assigned to this invoker.
      Specified by:
      performReset in interface EventHandlerInvoker
      Type Parameters:
      R - the type of the provided resetContext
      Parameters:
      resetContext - a R used to support the reset operation