GH-3696: DeserializationEx support for KafkaMS (#8689)
* GH-3696: DeserializationEx support for KafkaMS Fixes https://github.com/spring-projects/spring-integration/issues/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
This commit is contained in:
@@ -436,6 +436,11 @@ If you set `allowMultiFetch` to `true` you must process all the retrieved record
|
||||
|
||||
Messages emitted by this adapter contain a header `kafka_remainingRecords` with a count of records remaining from the previous poll.
|
||||
|
||||
Starting with version `6.2`, the `KafkaMessageSource` supports an `ErrorHandlingDeserializer` provided in the consumer properties.
|
||||
A `DeserializationException` is extracted from record headers and thrown to the called.
|
||||
With a `SourcePollingChannelAdapter` this exception is wrapped into an `ErrorMessage` and published to its `errorChannel`.
|
||||
See https://docs.spring.io/spring-kafka/reference/html/#error-handling-deserializer[`ErrorHandlingDeserializer`] documentation for more information.
|
||||
|
||||
[[kafka-outbound-gateway]]
|
||||
=== Outbound Gateway
|
||||
|
||||
@@ -448,7 +453,7 @@ It is suggested that you add a `ConsumerRebalanceListener` to the template's rep
|
||||
|
||||
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.
|
||||
This has been changed for consistency because you may get unexpected behavior (Spring may time out the `send()`, while it is actually, eventually, successful).
|
||||
IMPORTANT: That timeout is 120 seconds by default so you may wish to reduce it to get more timely failures.
|
||||
IMPORTANT: That timeout is 120 seconds by default, so you may wish to reduce it to get more timely failures.
|
||||
|
||||
[[kafka-outbound-gateway-configuration]]
|
||||
==== Configuration
|
||||
|
||||
@@ -38,3 +38,10 @@ See, for example, `transformWith()`, `splitWith()` in <<./dsl.adoc#java-dsl, Jav
|
||||
- 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`.
|
||||
This strategy determines the behavior when a session's outbound message buffer has reached the configured limit.
|
||||
See <<./web-sockets.adoc#websocket-client-container-attributes, WebSockets Support>> for more information.
|
||||
|
||||
|
||||
[[x6.2-kafka]]
|
||||
=== Apache Kafka Support Changes
|
||||
|
||||
The `KafkaMessageSource` now extracts an `ErrorHandlingDeserializer` configuration from the consumer properties and re-throws `DeserializationException` extracted from failed record headers.
|
||||
See <<./kafka.adoc#kafka-inbound-pollable, Kafka Inbound Channel Adapter>> for more information.
|
||||
|
||||
Reference in New Issue
Block a user