Skip to content

Commit 771c612

Browse files
GH-2184 KafkaBackOffException logged as ERROR
Fixes #2184
1 parent 1d13671 commit 771c612

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

spring-kafka/src/main/java/org/springframework/kafka/listener/FailedRecordProcessor.java

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -152,10 +152,16 @@ protected RecoveryStrategy getRecoveryStrategy(List<ConsumerRecord<?, ?>> record
152152
}
153153
catch (Exception ex) {
154154
if (records.size() > 0) {
155-
this.logger.error(ex, () -> "Recovery of record ("
156-
+ KafkaUtils.format(records.get(0)) + ") failed");
157-
this.failureTracker.getRetryListeners().forEach(rl ->
158-
rl.recoveryFailed(records.get(0), thrownException, ex));
155+
if (SeekUtils.isBackoffException(ex)) {
156+
this.logger.debug("Recovery of record ("
157+
+ KafkaUtils.format(records.get(0)) + ") backed off: " + ex.getMessage());
158+
}
159+
else {
160+
this.logger.error(ex, () -> "Recovery of record ("
161+
+ KafkaUtils.format(records.get(0)) + ") failed");
162+
this.failureTracker.getRetryListeners().forEach(rl ->
163+
rl.recoveryFailed(records.get(0), thrownException, ex));
164+
}
159165
}
160166
return (rec, excep, cont, consumer) -> NEVER_SKIP_PREDICATE.test(rec, excep);
161167
}

0 commit comments

Comments
 (0)