uptop opened a new issue #351: 不同的client同一个consumerGroup订阅多个topic,负载均衡有问题 URL: https://github.com/apache/rocketmq/issues/351 The issue tracker is **ONLY** used for bug report and feature request. Keep in mind, please check whether there is an existing same report before your raise a new one. Alternately (especially if your communication is not a bug report), you can send mail to our [mailing lists](http://rocketmq.apache.org/about/contact/). We welcome any friendly suggestions, bug fixes, collaboration and other improvements. Please ensure that your bug report is clear and that it is complete. Otherwise, we may be unable to understand it or to reproduce it, either of which would prevent us from fixing the bug. We strongly recommend the report(bug report or feature request) could include some hints as the following: **BUG REPORT** 1. Please describe the issue you observed: - 多台机器,用同一个consumerGroup订阅多个topic,比如IP1用rocketmq_consumer订阅topicA(4个队列),IP1、IP2用rocketmq_consumer订阅topicB(4个队列) - What did you expect to see? 期望正常消费 - What did you see instead? 然而,client启动后,topicA能被IP1正常消费,topicB有一半的队列被IP1消费,而另一半的队列没有client消费。 2. Please tell us about your environment: JDK1.8 RocketMQ4.1 3. Other information (e.g. detailed explanation, logs, related issues, suggestions how to fix, etc): check代码后,发现org.apache.rocketmq.broker.client.registerConsumer会把初始化后的client信息记录到ConcurrentMap<String/* Group */, ConsumerGroupInfo> consumerTable中,而ConsumerGroupInfo的属性ConcurrentMap<Channel, ClientChannelInfo> channelInfoTable记录了clientId,也就是说,如果IP1和IP2都用rocketmq_consumer初始化了一个consumer,那么channelInfoTable中的ClientChannelInfo的clientId就是IP1@port,IP2@port,此时IP1向Broker发送心跳,做负载均衡,从Broker获取到的结果ConsumerManageProcessor.getConsumerListByGroup就有两个client,而实际上只有IP1订阅了topicA,但client从Broker拿到了两个clientID,会认为有两个client订阅了topicA,基于AllocateMessageQueueAveragely.allocate的负载均衡的结果就是topicA的两个队列分配给了IP1去消费,而另外两个队列却没有client取消费(因为IP2没有订阅这个topic),这样就会导致部分队列始终无法被消费。
---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: [email protected] With regards, Apache Git Services
