Annotation 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
-
Optional Element Summary
Optional ElementsModifier and TypeOptional ElementDescriptionThe types of exceptions to retry, used with RETRY_ON_ERROR, seeErrorStrategyValue
.int
The retry count used with RETRY_ON_ERROR and RETRY_EXPONENTIALLY_ON_ERRORErrorStrategyValue
.The delay used with RETRY_ON_ERROR and RETRY_EXPONENTIALLY_ON_ERRORErrorStrategyValue
.The strategy to use when an error occurs, seeErrorStrategyValue
. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final int
Default retry delay in seconds.static final int
Default retry attempts.
-
Field Details
-
DEFAULT_DELAY_IN_SECONDS
static final int DEFAULT_DELAY_IN_SECONDSDefault retry delay in seconds.- See Also:
-
DEFAULT_RETRY_COUNT
static final int DEFAULT_RETRY_COUNTDefault retry attempts.- See Also:
-
-
Element Details
-
retryDelay
String retryDelayThe delay used with RETRY_ON_ERROR and RETRY_EXPONENTIALLY_ON_ERRORErrorStrategyValue
.- Returns:
- the delay by which to wait for the next retry
- Default:
- "1s"
-
retryCount
int retryCountThe retry count used with RETRY_ON_ERROR and RETRY_EXPONENTIALLY_ON_ERRORErrorStrategyValue
.- Returns:
- the retry count of how many attempts should be made
- Default:
- 1
-
value
ErrorStrategyValue valueThe strategy to use when an error occurs, seeErrorStrategyValue
.- Returns:
- the error strategy
- Default:
- NONE
-
exceptionTypes
The types of exceptions to retry, used with RETRY_ON_ERROR, seeErrorStrategyValue
.- Returns:
- the list of exceptions types
- Since:
- 4.5.0
- Default:
- {}
-