Skip to content

Commit 633519f

Browse files
committed
PR review
Signed-off-by: Soby Chacko <[email protected]>
1 parent 71647d4 commit 633519f

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

spring-kafka-docs/src/main/antora/modules/ROOT/pages/kafka/annotation-error-handling.adoc

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -246,8 +246,9 @@ public DefaultErrorHandler errorHandler(ConsumerRecordRecoverer recoverer) {
246246
The `DefaultErrorHandler` only processes exceptions that inherit from `RuntimeException`.
247247
Exceptions inheriting from `Error` bypass the error handler entirely, causing the consumer to terminate immediately, close the Kafka connection, and skip all retry/recovery mechanisms.
248248
This critical distinction means applications may report healthy status despite having terminated consumers that no longer process messages.
249-
Always ensure that exceptions thrown in message processing code extend from `RuntimeException` rather than `Error` to allow proper error handling.
250-
249+
Always ensure that exceptions thrown in message processing code explicitly extend from `RuntimeException` rather than `Error` to allow proper error handling.
250+
In other words, if the application throws an exception, ensure that it is extended from `RuntimeException` and not inadvertently inherited from `Error`.
251+
Standard errors like `OutOfMemoryError`, `IllegalAccessError`, and other errors beyond the control of the application are still treated as `Error`s and not retried.
251252

252253
The error handler can be configured with one or more `RetryListener`+++s+++, receiving notifications of retry and recovery progress.
253254
Starting with version 2.8.10, methods for batch listeners were added.

0 commit comments

Comments
 (0)