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-1
Original file line number
Diff line number
Diff line change
@@ -5058,6 +5058,8 @@ These error handlers can handle errors for both record and batch listeners, allo
5058
5058
`CommonErrorHandler` implementations to replace most legacy framework error handler implementations are provided and the legacy error handlers deprecated.
5059
5059
The legacy interfaces are still supported by listener containers and listener container factories; they will be deprecated in a future release.
5060
5060
5061
+
See <<migrating-legacy-eh>> for information to convert custom error handlers to `CommonErrorHandler`.
5062
+
5061
5063
When transactions are being used, no error handlers are configured, by default, so that the exception will roll back the transaction.
5062
5064
Error handling for transactional containers are handled by the <<after-rollback,`AfterRollbackProcessor`>>.
5063
5065
If you provide a custom error handler when using transactions, it must throw an exception if you want the transaction rolled back.
@@ -5267,7 +5269,7 @@ By default, the exception type is not considered.
5267
5269
Also see <<delivery-header>>.
5268
5270
5269
5271
[[batch-listener-conv-errors]]
5270
-
===== Conversion Errors with Batch Error Handlers
5272
+
====== Conversion Errors with Batch Error Handlers
5271
5273
5272
5274
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`.
5273
5275
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`.
@@ -5384,6 +5386,20 @@ If you wish to use a different error handling strategy for record and batch list
5384
5386
|No replacements - use `DefaultErrorHandler` and throw an exception other than `BatchListenerFailedException`.
5385
5387
|===
5386
5388
5389
+
[[migrating-legacy-eh]]
5390
+
====== Migrating Custom Legacy Error Handler Implementations to `CommonErrorHandler`
5391
+
5392
+
Refer to the javadocs in `CommonErrorHandler`.
5393
+
5394
+
To replace an `ErrorHandler` or `ConsumerAwareErrorHandler` implementation, you should implement `handleRecord()` and leave `remainingRecords()` to return `false` (default).
5395
+
You should also implement `handleOtherException()` - to handle exceptions that occur outside the scope of record processing (e.g. consumer errors).
5396
+
5397
+
To replace a `RemainingRecordsErrorHandler` implementation, you should implement `handleRemaining()` and override `remainingRecords()` to return `true`.
5398
+
You should also implement `handleOtherException()` - to handle exceptions that occur outside the scope of record processing (e.g. consumer errors).
5399
+
5400
+
To replace any `BatchErrorHandler` implementation, you should implement `handleBatch()`
5401
+
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-2
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