Enum Class ErrorStrategyValue
- All Implemented Interfaces:
Serializable
,Comparable<ErrorStrategyValue>
,Constable
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
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>>
-
Enum Constant Summary
Enum ConstantDescriptionDeprecated.maintain broken, but consistent behaviour with previous versions of micronaut-kafka that do not support error strategy.This strategy will ignore the current error and will resume at the next offset.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.This strategy will stop consuming subsequent records in the case of an error and will attempt to re-consume the current record indefinitely. -
Method Summary
Modifier and TypeMethodDescriptioncomputeRetryDelay
(@Nullable Duration fixedRetryDelay, long retryAttempts) Compute retry delay given a fixed delay and the number of attempts.boolean
isRetry()
static ErrorStrategyValue
Returns the enum constant of this class with the specified name.static ErrorStrategyValue[]
values()
Returns an array containing the constants of this enum class, in the order they are declared.
-
Enum Constant Details
-
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
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
This strategy will ignore the current error and will resume at the next offset. -
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/372This error strategy will skip over all records from the current offset in the current poll when the consumer encounters an error.
-
-
Method Details
-
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
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 nameNullPointerException
- if the argument is null
-
isRetry
public boolean isRetry()- Returns:
- Whether this is a retry error strategy.
- Since:
- 5.2
-
computeRetryDelay
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
-