Interface ListenerInvocationErrorHandler

All Known Implementing Classes:
LoggingErrorHandler, PropagatingErrorHandler

public interface ListenerInvocationErrorHandler
Interface of an error handler that is invoked when an exception is triggered as result of an EventMessageHandler handling an event.
Author:
Rene de Waele
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    onError(Exception exception, EventMessage<?> event, EventMessageHandler eventHandler)
    Invoked after given eventListener failed to handle given event.
  • Method Details

    • onError

      void onError(@Nonnull Exception exception, @Nonnull EventMessage<?> event, @Nonnull EventMessageHandler eventHandler) throws Exception
      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.
      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