diff --git a/kafka-streams-samples/kafka-streams-multiple-input-topics/pom.xml b/kafka-streams-samples/kafka-streams-multiple-input-topics/pom.xml index bb5bdc0..af701bf 100644 --- a/kafka-streams-samples/kafka-streams-multiple-input-topics/pom.xml +++ b/kafka-streams-samples/kafka-streams-multiple-input-topics/pom.xml @@ -14,7 +14,6 @@ kafka-streams-multiple-input-topics Demo project for Spring Boot - 11 2020.0.3 diff --git a/recipes/recipe-14-unique-client-id-pollable-consumers.adoc b/recipes/recipe-14-unique-client-id-pollable-consumers.adoc new file mode 100644 index 0000000..3b03ab5 --- /dev/null +++ b/recipes/recipe-14-unique-client-id-pollable-consumers.adoc @@ -0,0 +1,26 @@ +# Gotchas when running multiple pollable consumers + +## Problem Statement + +How can I run multiple instances of the pollable consumers and generate unique client.id for each instance? + +## Solution + +Assuming that I have the following definition: + +``` +spring.cloud.stream.pollable-source: foo +spring.cloud.stream.bindings.foo-in-0.group: my-group +``` + +When running the application, the Kafka consumer generates a client.id (something like `consumer-my-group-1`). +For each instance of the application that is running, this `client.id` will be the same, causing unexpected issues. + +In order to fix this, you can add the following property on each instance of the application: + +``` +spring.cloud.stream.kafka.bindings.foo-in-0.consumer.configuration.client.id=${client.id} +``` + +See this issue for more details: https://github.com/spring-cloud/spring-cloud-stream-binder-kafka/issues/1139 +