We have a spring cloud stream app consuming from Kinesis stream with a single shard. The application has a consumer.concurrency of 2 and the spring.cloud.stream.instanceIndex and spring.cloud.stream.instanceCount are correctly set on each instance.
We have also added spring.cloud.stream.bindings.binding-target.group setting but this had no effect.
We have a statefulset with a minimum of 2 replicas.
The problem is that, when the messages are consumed from Kinesis, both instances are consuming the same data.
If we increase the number of shards from 1 to 2 then this problem goes away.
We are using the following maven dependencies:
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-stream-binder-kinesis</artifactId>
<version>2.2.0</version>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-dependencies</artifactId>
<version>2021.0.2</version>
<type>pom</type>
<scope>import</scope>
</dependency>
Why are the services consuming the same data when there is a single shard?