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
GH-3696: DeserializationEx support for KafkaMS (#8689)
* GH-3696: DeserializationEx support for KafkaMS
Fixes#3696
* Add an internal logic into `KafkaMessageSource` to react properly for the
`ErrorHandlingDeserializer` configuration and re-throw `DeserializationException`
* * Use `ErrorHandlingUtils` from `spring-kafka` to determine a `deserializer` from consumer properties
* Revise the test in favor of just single `await().untilAsserted()` -
no reason to wait for assignment or check for returned record.
We just need to be sure that `DeserializationException` is thrown eventually
Copy file name to clipboardExpand all lines: spring-integration-kafka/src/main/java/org/springframework/integration/kafka/inbound/KafkaMessageSource.java
Copy file name to clipboardExpand all lines: spring-integration-kafka/src/test/java/org/springframework/integration/kafka/inbound/MessageSourceIntegrationTests.java
+62-2
Original file line number
Diff line number
Diff line change
@@ -1,5 +1,5 @@
1
1
/*
2
-
* Copyright 2018-2022 the original author or authors.
2
+
* Copyright 2018-2023 the original author or authors.
3
3
*
4
4
* Licensed under the Apache License, Version 2.0 (the "License");
5
5
* you may not use this file except in compliance with the License.
Copy file name to clipboardExpand all lines: src/reference/asciidoc/kafka.adoc
+6-1
Original file line number
Diff line number
Diff line change
@@ -436,6 +436,11 @@ If you set `allowMultiFetch` to `true` you must process all the retrieved record
436
436
437
437
Messages emitted by this adapter contain a header `kafka_remainingRecords` with a count of records remaining from the previous poll.
438
438
439
+
Starting with version `6.2`, the `KafkaMessageSource` supports an `ErrorHandlingDeserializer` provided in the consumer properties.
440
+
A `DeserializationException` is extracted from record headers and thrown to the called.
441
+
With a `SourcePollingChannelAdapter` this exception is wrapped into an `ErrorMessage` and published to its `errorChannel`.
442
+
See https://docs.spring.io/spring-kafka/reference/html/#error-handling-deserializer[`ErrorHandlingDeserializer`] documentation for more information.
443
+
439
444
[[kafka-outbound-gateway]]
440
445
=== Outbound Gateway
441
446
@@ -448,7 +453,7 @@ It is suggested that you add a `ConsumerRebalanceListener` to the template's rep
448
453
449
454
The `KafkaProducerMessageHandler` `sendTimeoutExpression` default is `delivery.timeout.ms` Kafka producer property `+ 5000` so that the actual Kafka error after a timeout is propagated to the application, instead of a timeout generated by this framework.
450
455
This has been changed for consistency because you may get unexpected behavior (Spring may time out the `send()`, while it is actually, eventually, successful).
451
-
IMPORTANT: That timeout is 120 seconds by default so you may wish to reduce it to get more timely failures.
456
+
IMPORTANT: That timeout is 120 seconds by default, so you may wish to reduce it to get more timely failures.
Copy file name to clipboardExpand all lines: src/reference/asciidoc/whats-new.adoc
+7
Original file line number
Diff line number
Diff line change
@@ -38,3 +38,10 @@ See, for example, `transformWith()`, `splitWith()` in <<./dsl.adoc#java-dsl, Jav
38
38
- For the server and client WebSocket containers, the send buffer overflow strategy is now configurable in `IntegrationWebSocketContainer` and in XML via `send-buffer-overflow-strategy`.
39
39
This strategy determines the behavior when a session's outbound message buffer has reached the configured limit.
40
40
See <<./web-sockets.adoc#websocket-client-container-attributes, WebSockets Support>> for more information.
41
+
42
+
43
+
[[x6.2-kafka]]
44
+
=== Apache Kafka Support Changes
45
+
46
+
The `KafkaMessageSource` now extracts an `ErrorHandlingDeserializer` configuration from the consumer properties and re-throws `DeserializationException` extracted from failed record headers.
47
+
See <<./kafka.adoc#kafka-inbound-pollable, Kafka Inbound Channel Adapter>> for more information.
0 commit comments