首页 文章

消息发布到spring-data-stream项目中具有相同使用者组的所有使用者

提问于
浏览
0

我让我的动物园管理员和3名 Kafka 经纪人在当地运营 . 我开了一个 生产环境 者和一个消费者 . 我可以看到消费者正在消费消息 .

然后我启动了三个具有相同使用者组名称的消费者(自 spring 启动项目以来的不同端口) . 但我发现所有消费者现在正在消费(接收)消息 . 但我希望消息能够进行负载 balancer ,因为只有消息不会在消费者中重复 . 我不知道问题是什么 .

这是我的属性文件

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

这里的组是timerGroup .

消费者代码:https://github.com/codecentric/edmp-sample-stream-sink

生产环境 者代码:https://github.com/codecentric/edmp-sample-stream-source

1 回答

  • 0

    你能否将依赖关系更新为 Camden.RELEASE (并开始使用Kafka 0.9)?在 Brixton.RELEASE 中,Kafka使用者基于0.8,并且需要将instanceIndex / instanceCount作为属性传递,以便正确分发分区 .

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

相关问题