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
Handle `DeserializationException` via `ErrorHandlingDeserializer` in
`ReplyingKafkaTemplate`.
**I will do the backports after review/merge; I expect conflicts**
Copy file name to clipboardExpand all lines: src/reference/asciidoc/kafka.adoc
+8Lines changed: 8 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -589,6 +589,9 @@ public class KRequestingApplication {
589
589
590
590
Note that we can use Boot's auto-configured container factory to create the reply container.
591
591
592
+
If a non-trivial deserializer is being used for replies, consider using an <<error-handling-deserializer,`ErrorHandlingDeserializer`>> that delegates to your configured deserializer.
593
+
When so configured, the `RequestReplyFuture` will be completed exceptionally and you can catch the `ExecutionException`, with the `DeserializationException` in its `cause` property.
594
+
592
595
The template sets a header (named `KafkaHeaders.CORRELATION_ID` by default), which must be echoed back by the server side.
593
596
594
597
In this case, the following `@KafkaListener` application responds:
@@ -771,6 +774,11 @@ IMPORTANT: The listener container for the replies MUST be configured with `AckMo
771
774
To avoid any possibility of losing messages, the template only commits offsets when there are zero requests outstanding, i.e. when the last outstanding request is released by the release strategy.
772
775
After a rebalance, it is possible for duplicate reply deliveries; these will be ignored for any in-flight requests; you may see error log messages when duplicate replies are received for already released replies.
773
776
777
+
NOTE: If you use an <<error-handling-deserializer,`ErrorHandlingDeserializer`>> with this aggregating template, the framework will not automatically detect `DeserializationException` s.
778
+
Instead, the record (with a `null` value) will be returned intact, with the deserialization exception(s) in headers.
779
+
It is recommended that applications call the utility method `ReplyingKafkaTemplate.checkDeserialization()` method to determine if a deserialization exception occurred.
0 commit comments