Annotation Interface ErrorStrategy


@Documented @Retention(RUNTIME) public @interface ErrorStrategy
Setting the error strategy allows you to resume at the next offset or to seek the consumer (stop on error) to the failed offset so that it can retry if an error occurs. The consumer bean is still able to implement a custom exception handler to replace DefaultKafkaListenerExceptionHandler as well as set the error strategy.
Since:
4.1
Author:
Christopher Webb, Vishal Sulibhavi, Denis Stepanov
  • Field Details

    • DEFAULT_DELAY_IN_SECONDS

      static final int DEFAULT_DELAY_IN_SECONDS
      Default retry delay in seconds.
      See Also:
    • DEFAULT_RETRY_COUNT

      static final int DEFAULT_RETRY_COUNT
      Default retry attempts.
      See Also:
    • DEFAULT_HANDLE_ALL_EXCEPTIONS

      static final boolean DEFAULT_HANDLE_ALL_EXCEPTIONS
      Default handle all exceptions.
      See Also:
  • Element Details

    • retryDelay

      String retryDelay
      The delay used with RETRY_ON_ERROR and RETRY_EXPONENTIALLY_ON_ERROR ErrorStrategyValue.
      Returns:
      the delay by which to wait for the next retry
      Default:
      "1s"
    • retryCount

      int retryCount
      The fixed retry count used with RETRY_ON_ERROR and RETRY_EXPONENTIALLY_ON_ERROR ErrorStrategyValue.

      retryCount takes precedence over retryCountValue if they are both set.

      Returns:
      the retry count of how many attempts should be made
      See Also:
      Default:
      1
    • retryCountValue

      @AliasFor(member="retryCount") String retryCountValue
      The dynamic retry count used with RETRY_ON_ERROR and RETRY_EXPONENTIALLY_ON_ERROR ErrorStrategyValue.

      retryCountValue will be overridden by retryCount if they are both set.

      Returns:
      the retry count of how many attempts should be made
      See Also:
      Default:
      ""
    • handleAllExceptions

      boolean handleAllExceptions
      Whether all exceptions should be handled or ignored when using RETRY_ON_ERROR and RETRY_EXPONENTIALLY_ON_ERROR ErrorStrategyValue. By default, only the last failed attempt will be handed over to the exception handler.
      Returns:
      whether all exceptions should be handled or ignored
      Since:
      5.0
      Default:
      false
    • value

      The strategy to use when an error occurs, see ErrorStrategyValue.
      Returns:
      the error strategy
      Default:
      NONE
    • exceptionTypes

      Class<? extends Throwable>[] exceptionTypes
      The types of exceptions to retry, used with RETRY_ON_ERROR, see ErrorStrategyValue.
      Returns:
      the list of exceptions types
      Since:
      4.5.0
      Default:
      {}