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
Resolves#1340
Previously, a reply type of `Collection` always split the collection
into discrete replies.
There is now an option to send the entire collection in the reply.
* Fix cast.
* Fix doc link.
Copy file name to clipboardExpand all lines: spring-kafka/src/main/java/org/springframework/kafka/annotation/KafkaListenerAnnotationBeanPostProcessor.java
Copy file name to clipboardExpand all lines: spring-kafka/src/main/java/org/springframework/kafka/listener/adapter/MessagingMessageListenerAdapter.java
+41-9Lines changed: 41 additions & 9 deletions
Original file line number
Diff line number
Diff line change
@@ -23,6 +23,7 @@
23
23
importjava.nio.ByteBuffer;
24
24
importjava.nio.charset.StandardCharsets;
25
25
importjava.util.Collection;
26
+
importjava.util.Iterator;
26
27
importjava.util.List;
27
28
importjava.util.Map;
28
29
importjava.util.stream.Collectors;
@@ -123,6 +124,8 @@ public abstract class MessagingMessageListenerAdapter<K, V> implements ConsumerS
Copy file name to clipboardExpand all lines: src/reference/asciidoc/kafka.adoc
+5Lines changed: 5 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1744,6 +1744,11 @@ public KafkaListenerErrorHandler voidSendToErrorHandler() {
1744
1744
See <<annotation-error-handling>> for more information.
1745
1745
====
1746
1746
1747
+
NOTE: If a listener method returns an `Iterable`, by default a record for each element as the value is sent.
1748
+
Starting with version 2.3.5, set the `splitIterables` property on `@KafkaListener` to `false` and the entire result will be sent as the value of a single `ProducerRecord`.
1749
+
This requires a suitable serializer in the reply template's producer configuration.
1750
+
However, if the reply is `Iterable<Message<?>>` the property is ignored and each message is sent separately.
1751
+
1747
1752
===== Filtering Messages
1748
1753
1749
1754
In certain scenarios, such as rebalancing, a message that has already been processed may be redelivered.
Copy file name to clipboardExpand all lines: src/reference/asciidoc/whats-new.adoc
+6Lines changed: 6 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -38,6 +38,12 @@ See <<aggregating-request-reply>> for more information.
38
38
The `ContainerProperties` provides an `authorizationExceptionRetryInterval` option to let the listener container to retry after any `AuthorizationException` is thrown by the `KafkaConsumer`.
39
39
See its JavaDocs and <<kafka-container>> for more information.
40
40
41
+
==== @KafkaListener
42
+
43
+
The `@KafkaListener` annotation has a new property `splitIterables`; default true.
44
+
When a replying listener returns an `Iterable` this property controls whether the return result is sent as a single record or a record for each element is sent.
45
+
See <<annotation-send-to>> for more information.
46
+
41
47
=== Migration Guide
42
48
43
49
* This release is essentially the same as the 2.3.x line, except it has been compiled against the 2.4 `kafka-clients` jar, due to a binary incompatibility.
0 commit comments