Enum Class PropagatingErrorHandler

java.lang.Object
java.lang.Enum<PropagatingErrorHandler>
org.axonframework.eventhandling.PropagatingErrorHandler
All Implemented Interfaces:
Serializable, Comparable<PropagatingErrorHandler>, Constable, ErrorHandler, ListenerInvocationErrorHandler

public enum PropagatingErrorHandler extends Enum<PropagatingErrorHandler> implements ErrorHandler, ListenerInvocationErrorHandler
Singleton ErrorHandler implementation that does not do anything.
Author:
Rene de Waele
  • Enum Constant Details

  • Method Details

    • values

      public static PropagatingErrorHandler[] values()
      Returns an array containing the constants of this enum class, in the order they are declared.
      Returns:
      an array containing the constants of this enum class, in the order they are declared
    • valueOf

      public static PropagatingErrorHandler valueOf(String name)
      Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      IllegalArgumentException - if this enum class has no constant with the specified name
      NullPointerException - if the argument is null
    • instance

      public static PropagatingErrorHandler instance()
      Singleton instance of a PropagatingErrorHandler.
      Returns:
      the singleton instance of PropagatingErrorHandler
    • onError

      public void onError(@Nonnull Exception exception, @Nonnull EventMessage<?> event, @Nonnull EventMessageHandler eventHandler) throws Exception
      Description copied from interface: ListenerInvocationErrorHandler
      Invoked after given eventListener failed to handle given event. Implementations have a choice of options for how to continue:

      • To ignore this error no special action is required. Processing will continue for this and subsequent events.
      • To retry processing the event, implementations can re-invoke EventMessageHandler.handle(EventMessage) on the eventListener once or multiple times.
      • To terminate event handling altogether and stop propagating the event to other listeners implementations may throw an exception.
      Specified by:
      onError in interface ListenerInvocationErrorHandler
      Parameters:
      exception - The exception thrown by the given eventListener
      event - The event that triggered the exception
      eventHandler - The listener that failed to handle given event
      Throws:
      Exception - To stop further handling of the event
    • handleError

      public void handleError(@Nonnull ErrorContext errorContext) throws Exception
      Description copied from interface: ErrorHandler
      Handle an error raised during event processing. Generally this means that the UnitOfWork created to coordinate the event processing was rolled back. Using default configuration the ErrorHandler is only invoked when there is a serious error, for instance when the database transaction connected to the UnitOfWork can not be committed.

      The error handler has the option to simply log or ignore the error. Depending on the type of EventProcessor this will put an end to the processing of any further events (in case of a TrackingEventProcessor) or simply skip over the list of given failedEvents.

      Note that although the UnitOfWork and hence any related database transactions have been rolled back when the error handler is invoked, the processing of one or more of the failedEvents may in fact have caused other side effects which could not be reverted.

      Specified by:
      handleError in interface ErrorHandler
      Parameters:
      errorContext - Contextual information describing the error
      Throws:
      Exception - if the handler decides to propagate the error