0

I got my zookeeper and 3 kafka broker running locally. I started one producer and one consumer. I can see consumer is consuming message.

I then started three consumers with same consumer group name (different ports since its a spring boot project). but what I found is that all the consumers are now consuming (receiving) messages. But I expect the message to be load-balanced in that only messages are not repeated across the consumers. I don't know what the problem is.

Here is my property file

spring.cloud.stream.bindings.input.destination=timerTopicLocal
spring.cloud.stream.kafka.binder.zkNodes=localhost
spring.cloud.stream.kafka.binder.brokers=localhost
spring.cloud.stream.bindings.input.group=timerGroup

Here the group is timerGroup.

consumer code : https://github.com/codecentric/edmp-sample-stream-sink

producer code : https://github.com/codecentric/edmp-sample-stream-source

4

1 回答 1

0

您能否将依赖项更新为Camden.RELEASE(并开始使用 Kafka 0.9+)?在Brixton.RELEASEKafka 消费者是基于 0.8 的,并且需要传递 instanceIndex/instanceCount 作为属性才能正确分配分区。

我们正在使用 Kafka 0.9+ 消费者客户端,它以Camden.RELEASE您期望的方式进行负载平衡(我们还支持通过 instanceIndex/instanceCount 进行静态分区分配,但我怀疑这不是您想要的)。我可以详细了解如何使用 Brixton 进行配置,但我想升级应该是一条更容易的路径。

于 2016-09-29T04:59:00.050 回答