All Known Implementing Classes:
PropagatingErrorHandler
Functional Interface:
This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

@FunctionalInterface public interface ErrorHandler
Interface of the error handler that will be invoked if event processing fails.

The error handler is generally invoked by an EventProcessor when the ProcessingContext created to coordinate the event processing was rolled back.

Since:
3.0.0
Author:
Rene de Waele
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    handleError(ErrorContext errorContext)
    Handle an error raised during event processing.
  • Method Details

    • handleError

      void handleError(@Nonnull ErrorContext errorContext) throws Exception
      Handle an error raised during event processing.

      Generally this means that the ProcessingContext 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 ProcessingContext 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 PooledStreamingEventProcessor) or simply skip over the list of failedEvents in the given errorContext.

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

      Parameters:
      errorContext - Contextual information describing the error.
      Throws:
      Exception - If this handler decides to propagate the error.