You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: spring-kafka-docs/src/main/asciidoc/kafka.adoc
+17-1Lines changed: 17 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -4993,6 +4993,8 @@ These error handlers can handle errors for both record and batch listeners, allo
4993
4993
`CommonErrorHandler` implementations to replace most legacy framework error handler implementations are provided and the legacy error handlers deprecated.
4994
4994
The legacy interfaces are still supported by listener containers and listener container factories; they will be deprecated in a future release.
4995
4995
4996
+
See <<migrating-legacy-eh>> for information to migrate custom error handlers to `CommonErrorHandler`.
4997
+
4996
4998
When transactions are being used, no error handlers are configured, by default, so that the exception will roll back the transaction.
4997
4999
Error handling for transactional containers are handled by the <<after-rollback,`AfterRollbackProcessor`>>.
4998
5000
If you provide a custom error handler when using transactions, it must throw an exception if you want the transaction rolled back.
@@ -5202,7 +5204,7 @@ By default, the exception type is not considered.
5202
5204
Also see <<delivery-header>>.
5203
5205
5204
5206
[[batch-listener-conv-errors]]
5205
-
==== Conversion Errors with Batch Error Handlers
5207
+
====== Conversion Errors with Batch Error Handlers
5206
5208
5207
5209
Starting with version 2.8, batch listeners can now properly handle conversion errors, when using a `MessageConverter` with a `ByteArrayDeserializer`, a `BytesDeserializer` or a `StringDeserializer`, as well as a `DefaultErrorHandler`.
5208
5210
When a conversion error occurs, the payload is set to null and a deserialization exception is added to the record headers, similar to the `ErrorHandlingDeserializer`.
@@ -5319,6 +5321,20 @@ If you wish to use a different error handling strategy for record and batch list
5319
5321
|No replacements - use `DefaultErrorHandler` and throw an exception other than `BatchListenerFailedException`.
5320
5322
|===
5321
5323
5324
+
[[migrating-legacy-eh]]
5325
+
====== Migrating Custom Legacy Error Handler Implementations to `CommonErrorHandler`
5326
+
5327
+
Refer to the javadocs in `CommonErrorHandler`.
5328
+
5329
+
To replace an `ErrorHandler` or `ConsumerAwareErrorHandler` implementation, you should implement `handleRecord()` and leave `remainingRecords()` to return `false` (default).
5330
+
You should also implement `handleOtherException()` - to handle exceptions that occur outside the scope of record processing (e.g. consumer errors).
5331
+
5332
+
To replace a `RemainingRecordsErrorHandler` implementation, you should implement `handleRemaining()` and override `remainingRecords()` to return `true`.
5333
+
You should also implement `handleOtherException()` - to handle exceptions that occur outside the scope of record processing (e.g. consumer errors).
5334
+
5335
+
To replace any `BatchErrorHandler` implementation, you should implement `handleBatch()`
5336
+
You should also implement `handleOtherException()` - to handle exceptions that occur outside the scope of record processing (e.g. consumer errors).
Copy file name to clipboardExpand all lines: spring-kafka-docs/src/main/asciidoc/whats-new.adoc
+2-2Lines changed: 2 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -54,7 +54,7 @@ See <<kafka-template-receive>> for more information.
54
54
==== `CommonErrorHandler` Added
55
55
56
56
The legacy `GenericErrorHandler` and its sub-interface hierarchies for record an batch listeners have been replaced by a new single interface `CommonErrorHandler` with implementations corresponding to most legacy implementations of `GenericErrorHandler`.
57
-
See <<error-handlers>> for more information.
57
+
See <<error-handlers>> and <<migrating-legacy-eh>> for more information.
58
58
59
59
[[x28-lcc]]
60
60
==== Listener Container Changes
@@ -92,4 +92,4 @@ You can now use blocking and non-blocking retries in conjunction.
92
92
See <<retry-topic-combine-blocking>> for more information.
93
93
94
94
The KafkaBackOffException thrown when using the retryable topics feature is now logged at DEBUG level.
95
-
See <<change-kboe-logging-level>> if you need to change the logging level back to WARN or set it to any other level.
95
+
See <<change-kboe-logging-level>> if you need to change the logging level back to WARN or set it to any other level.
0 commit comments