Class ExceptionClassifier
java.lang.Object
org.springframework.kafka.listener.KafkaExceptionLogLevelAware
org.springframework.kafka.listener.ExceptionClassifier
- Direct Known Subclasses:
DeadLetterPublishingRecoverer,DefaultDestinationTopicResolver,FailedRecordProcessor
Supports exception classification.
- Since:
- 2.8
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfinal voidaddNotRetryableExceptions(Class<? extends Exception>... exceptionTypes) Add exception types to the default list.protected org.springframework.classify.BinaryExceptionClassifierReturn the exception classifier.booleanremoveNotRetryableException(Class<? extends Exception> exceptionType) Remove an exception type from the configured list.voidsetClassifications(Map<Class<? extends Throwable>, Boolean> classifications, boolean defaultValue) Set an exception classifications to determine whether the exception should cause a retry (until exhaustion) or not.Methods inherited from class org.springframework.kafka.listener.KafkaExceptionLogLevelAware
getLogLevel, setLogLevel
-
Constructor Details
-
ExceptionClassifier
public ExceptionClassifier()Construct the instance.
-
-
Method Details
-
getClassifier
protected org.springframework.classify.BinaryExceptionClassifier getClassifier()Return the exception classifier.- Returns:
- the classifier.
-
setClassifications
public void setClassifications(Map<Class<? extends Throwable>, Boolean> classifications, boolean defaultValue) Set an exception classifications to determine whether the exception should cause a retry (until exhaustion) or not. If not, we go straight to the recoverer. By default, the following exceptions will not be retried:DeserializationExceptionMessageConversionExceptionMethodArgumentResolutionExceptionNoSuchMethodExceptionClassCastException
- Parameters:
classifications- the classifications.defaultValue- whether or not to retry non-matching exceptions.- See Also:
-
BinaryExceptionClassifier(Map, boolean)addNotRetryableExceptions(Class...)
-
addNotRetryableExceptions
@SafeVarargs public final void addNotRetryableExceptions(Class<? extends Exception>... exceptionTypes) Add exception types to the default list. By default, the following exceptions will not be retried:DeserializationExceptionMessageConversionExceptionConversionExceptionMethodArgumentResolutionExceptionNoSuchMethodExceptionClassCastException
- Parameters:
exceptionTypes- the exception types.- See Also:
-
removeNotRetryableException
Remove an exception type from the configured list. By default, the following exceptions will not be retried:DeserializationExceptionMessageConversionExceptionConversionExceptionMethodArgumentResolutionExceptionNoSuchMethodExceptionClassCastException
- Parameters:
exceptionType- the exception type.- Returns:
- true if the removal was successful.
- See Also:
-