Enum Class ErrorStrategyValue

java.lang.Object
java.lang.Enum<ErrorStrategyValue>
io.micronaut.configuration.kafka.annotation.ErrorStrategyValue
All Implemented Interfaces:
Serializable, Comparable<ErrorStrategyValue>, Constable

public enum ErrorStrategyValue extends Enum<ErrorStrategyValue>
Defines the type of error handling strategy that micronaut-kafka will perform in case of error. The default exception handler or any custom exception handler will be performed after the error handling strategy has been run.
Since:
4.1
Author:
Christopher Webb, Vishal Sulibhavi
  • Enum Constant Details

    • RETRY_ON_ERROR

      public static final ErrorStrategyValue RETRY_ON_ERROR
      This strategy will stop consuming subsequent records in the case of an error and will attempt to re-consume the current record indefinitely.
    • RETRY_EXPONENTIALLY_ON_ERROR

      public static final ErrorStrategyValue RETRY_EXPONENTIALLY_ON_ERROR
      This strategy will stop consuming subsequent records in the case of an error and will attempt to re-consume the current record with exponentially growing time breaks between consumption attempts. Breaks' duration is computed based on the n * 2^(k - 1) formula, where n is the initial delay, and k is the number of retries.
    • RESUME_AT_NEXT_RECORD

      public static final ErrorStrategyValue RESUME_AT_NEXT_RECORD
      This strategy will ignore the current error and will resume at the next offset.
    • NONE

      @Deprecated public static final ErrorStrategyValue NONE
      Deprecated.
      maintain broken, but consistent behaviour with previous versions of micronaut-kafka that do not support error strategy. See https://github.com/micronaut-projects/micronaut-kafka/issues/372
      This error strategy will skip over all records from the current offset in the current poll when the consumer encounters an error.
  • Method Details

    • values

      public static ErrorStrategyValue[] 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 ErrorStrategyValue 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
    • isRetry

      public boolean isRetry()
      Returns:
      Whether this is a retry error strategy.
      Since:
      5.2
    • computeRetryDelay

      public Duration computeRetryDelay(@Nullable @Nullable Duration fixedRetryDelay, long retryAttempts)
      Compute retry delay given a fixed delay and the number of attempts.
      Parameters:
      fixedRetryDelay - The fixed retry delay.
      retryAttempts - The number of retries so far.
      Returns:
      The amount of time to wait before trying again.
      Since:
      5.2