Fix Kakfa Stream multiple input sample.
Add new recipe for multiple instances of pollable consumers.
This commit is contained in:
@@ -14,7 +14,6 @@
|
||||
<name>kafka-streams-multiple-input-topics</name>
|
||||
<description>Demo project for Spring Boot</description>
|
||||
<properties>
|
||||
<java.version>11</java.version>
|
||||
<spring-cloud.version>2020.0.3</spring-cloud.version>
|
||||
</properties>
|
||||
<dependencies>
|
||||
|
||||
26
recipes/recipe-14-unique-client-id-pollable-consumers.adoc
Normal file
26
recipes/recipe-14-unique-client-id-pollable-consumers.adoc
Normal file
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user