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: src/reference/asciidoc/kafka.adoc
+20-1Lines changed: 20 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -656,10 +656,29 @@ In this case, all instances receive each reply, but only the instance that sent
656
656
This may be useful for auto-scaling, but with the overhead of additional network traffic and the small cost of discarding each unwanted reply.
657
657
When you use this setting, we recommend that you set the template's `sharedReplyTopic` to `true`, which reduces the logging level of unexpected replies to DEBUG instead of the default ERROR.
658
658
659
+
The following is an example of configuring the reply container to use the same shared reply topic:
660
+
661
+
====
662
+
[source, java]
663
+
----
664
+
@Bean
665
+
public ConcurrentMessageListenerContainer<String, String> replyContainer(
IMPORTANT: If you have multiple client instances and you do not configure them as discussed in the preceding paragraph, each instance needs a dedicated reply topic.
660
679
An alternative is to set the `KafkaHeaders.REPLY_PARTITION` and use a dedicated partition for each instance.
661
680
The `Header` contains a four-byte int (big-endian).
662
-
The server must use this header to route the reply to the correct topic (`@KafkaListener` does this).
681
+
The server must use this header to route the reply to the correct partition (`@KafkaListener` does this).
663
682
In this case, though, the reply container must not use Kafka's group management feature and must be configured to listen on a fixed partition (by using a `TopicPartitionOffset` in its `ContainerProperties` constructor).
664
683
665
684
NOTE: The `DefaultKafkaHeaderMapper` requires Jackson to be on the classpath (for the `@KafkaListener`).
0 commit comments