Interface ErrorHandler

All Known Implementing Classes:
PropagatingErrorHandler

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 UnitOfWork created to coordinate the event processing was rolled back.
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 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.

      Parameters:
      errorContext - Contextual information describing the error
      Throws:
      Exception - if the handler decides to propagate the error