public abstract class FailedRecordProcessor extends KafkaExceptionLogLevelAware implements DeliveryAttemptAware
| Modifier and Type | Field and Description |
|---|---|
protected org.springframework.core.log.LogAccessor |
logger |
| Modifier | Constructor and Description |
|---|---|
protected |
FailedRecordProcessor(java.util.function.BiConsumer<org.apache.kafka.clients.consumer.ConsumerRecord<?,?>,java.lang.Exception> recoverer,
org.springframework.util.backoff.BackOff backOff) |
| Modifier and Type | Method and Description |
|---|---|
void |
addNotRetryableException(java.lang.Class<? extends java.lang.Exception> exceptionType)
Add an exception type to the default list; if and only if an external classifier
has not been provided.
|
void |
clearThreadState() |
int |
deliveryAttempt(TopicPartitionOffset topicPartitionOffset)
Return the next delivery attempt for the topic/partition/offset.
|
protected org.springframework.classify.BinaryExceptionClassifier |
getClassifier()
Return the exception classifier.
|
protected java.util.function.BiPredicate<org.apache.kafka.clients.consumer.ConsumerRecord<?,?>,java.lang.Exception> |
getSkipPredicate(java.util.List<org.apache.kafka.clients.consumer.ConsumerRecord<?,?>> records,
java.lang.Exception thrownException) |
protected boolean |
isCommitRecovered()
Whether the offset for a recovered record should be committed.
|
boolean |
removeNotRetryableException(java.lang.Class<? extends java.lang.Exception> exceptionType)
Remove an exception type from the configured list; if and only if an external
classifier has not been provided.
|
void |
setClassifications(java.util.Map<java.lang.Class<? extends java.lang.Throwable>,java.lang.Boolean> classifications,
boolean defaultValue)
Set an exception classifications to determine whether the exception should cause a retry
(until exhaustion) or not.
|
void |
setCommitRecovered(boolean commitRecovered)
Set to true to commit the offset for a recovered record.
|
void |
setResetStateOnRecoveryFailure(boolean resetStateOnRecoveryFailure)
Set to false to immediately attempt to recover on the next attempt instead
of repeating the BackOff cycle when recovery fails.
|
getLogLevel, setLogLevelprotected FailedRecordProcessor(@Nullable
java.util.function.BiConsumer<org.apache.kafka.clients.consumer.ConsumerRecord<?,?>,java.lang.Exception> recoverer,
org.springframework.util.backoff.BackOff backOff)
protected org.springframework.classify.BinaryExceptionClassifier getClassifier()
public void setClassifications(java.util.Map<java.lang.Class<? extends java.lang.Throwable>,java.lang.Boolean> classifications,
boolean defaultValue)
DeserializationExceptionMessageConversionExceptionMethodArgumentResolutionExceptionNoSuchMethodExceptionClassCastExceptionclassifications - the classifications.defaultValue - whether or not to retry non-matching exceptions.BinaryExceptionClassifier.BinaryExceptionClassifier(Map, boolean)protected boolean isCommitRecovered()
public void setCommitRecovered(boolean commitRecovered)
commitRecovered - true to commit.public void setResetStateOnRecoveryFailure(boolean resetStateOnRecoveryFailure)
resetStateOnRecoveryFailure - false to retain state.public int deliveryAttempt(TopicPartitionOffset topicPartitionOffset)
DeliveryAttemptAwaredeliveryAttempt in interface DeliveryAttemptAwaretopicPartitionOffset - the topic/partition/offset.public void addNotRetryableException(java.lang.Class<? extends java.lang.Exception> exceptionType)
DeserializationExceptionMessageConversionExceptionConversionExceptionMethodArgumentResolutionExceptionNoSuchMethodExceptionClassCastExceptionexceptionType - the exception type.removeNotRetryableException(Class),
setClassifications(Map, boolean)public boolean removeNotRetryableException(java.lang.Class<? extends java.lang.Exception> exceptionType)
DeserializationExceptionMessageConversionExceptionConversionExceptionMethodArgumentResolutionExceptionNoSuchMethodExceptionClassCastExceptionexceptionType - the exception type.addNotRetryableException(Class),
setClassifications(Map, boolean)protected java.util.function.BiPredicate<org.apache.kafka.clients.consumer.ConsumerRecord<?,?>,java.lang.Exception> getSkipPredicate(java.util.List<org.apache.kafka.clients.consumer.ConsumerRecord<?,?>> records,
java.lang.Exception thrownException)
public void clearThreadState()