You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@rocketmq.apache.org by GitBox <gi...@apache.org> on 2021/01/30 05:02:38 UTC

[GitHub] [rocketmq-spring] kengan opened a new issue #339: Why the consumer can not consume the message about a cluster with two broker

kengan opened a new issue #339:
URL: https://github.com/apache/rocketmq-spring/issues/339


   I have setup a rocketmq cluster with 2 master and 1 namesrv.
   I make 2 consumer program with  rocketmq-spring-boot-starter 2.2.0 and Spring boot 2.3.8. The main program abouot consumer is as following:
   
   package com.cesc.iot.handle.handler;
   
   import org.apache.rocketmq.spring.annotation.RocketMQMessageListener;
   import org.apache.rocketmq.spring.core.RocketMQReplyListener;
   import org.slf4j.Logger;
   import org.slf4j.LoggerFactory;
   import org.springframework.stereotype.Service;
   
   
   @Service
   @RocketMQMessageListener(topic = "${iot.rocketmq.topic}", consumerGroup = "iot_message_consumer")
   public class IotMessageHandler  implements RocketMQReplyListener<String,String> {
       private static final Logger logger = LoggerFactory.getLogger("BackgroundLogger");
       @Override
       public String onMessage(String message) {
           logger.info("recevice message from mq:"+message);
           return "ok";
   
       }
   }
   
   But I found that 2 consumer only consume the message in a broker.
   When stop one broker every thing is OK, but when I open two broker, some message in other broker can not be consume. Please see the following image about rocketmq-console
   ![QQ图片20210130125950](https://user-images.githubusercontent.com/18627678/106347611-13986580-62fb-11eb-86e9-11616a03c53b.png)
   
   Can you tell me why? Thank you 
   
   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [rocketmq-spring] kengan commented on issue #339: Why the consumer can not consume the message about a cluster with two broker

Posted by GitBox <gi...@apache.org>.
kengan commented on issue #339:
URL: https://github.com/apache/rocketmq-spring/issues/339#issuecomment-770158386


   ![Uploading QQ图片20210130125950.png…]()
   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [rocketmq-spring] kengan commented on issue #339: Why the consumer can not consume the message about a cluster with two broker

Posted by GitBox <gi...@apache.org>.
kengan commented on issue #339:
URL: https://github.com/apache/rocketmq-spring/issues/339#issuecomment-770313581


   @maixiaohai  how to  test your fix?


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [rocketmq-spring] maixiaohai commented on issue #339: Why the consumer can not consume the message about a cluster with two broker

Posted by GitBox <gi...@apache.org>.
maixiaohai commented on issue #339:
URL: https://github.com/apache/rocketmq-spring/issues/339#issuecomment-770177654


   We met the same problem when start consumer using docker container. 
   The root cause is two consumers have same instance name.


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [rocketmq-spring] RongtongJin commented on issue #339: Why the consumer can not consume the message about a cluster with two broker

Posted by GitBox <gi...@apache.org>.
RongtongJin commented on issue #339:
URL: https://github.com/apache/rocketmq-spring/issues/339#issuecomment-778624297


    clientid设置为ip@client本质上是为了让多个consumer或producer复用同一个网络模块,在容器中启动确实存在这样的问题,可以暂时通过在prepareStart方法([wiki第8条](https://github.com/apache/rocketmq-spring/wiki/%E5%B8%B8%E8%A7%81%E9%97%AE%E9%A2%98))中setInstanceName来解决。


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [rocketmq-spring] RongtongJin closed issue #339: Why the consumer can not consume the message about a cluster with two broker

Posted by GitBox <gi...@apache.org>.
RongtongJin closed issue #339:
URL: https://github.com/apache/rocketmq-spring/issues/339


   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [rocketmq-spring] maixiaohai commented on issue #339: Why the consumer can not consume the message about a cluster with two broker

Posted by GitBox <gi...@apache.org>.
maixiaohai commented on issue #339:
URL: https://github.com/apache/rocketmq-spring/issues/339#issuecomment-770325720


   > @maixiaohai how to test your fix?
   
   git fetch apache pull/342/head:pr342


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [rocketmq-spring] maixiaohai commented on issue #339: Why the consumer can not consume the message about a cluster with two broker

Posted by GitBox <gi...@apache.org>.
maixiaohai commented on issue #339:
URL: https://github.com/apache/rocketmq-spring/issues/339#issuecomment-770179529


   @kengan   I submit a pr to fix this problem, you can have a test on it.


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [rocketmq-spring] RongtongJin edited a comment on issue #339: Why the consumer can not consume the message about a cluster with two broker

Posted by GitBox <gi...@apache.org>.
RongtongJin edited a comment on issue #339:
URL: https://github.com/apache/rocketmq-spring/issues/339#issuecomment-778624297


    clientid设置为ip@client本质上是为了让多个consumer或producer复用同一个网络模块,在容器中启动确实存在这样的问题,可以暂时通过在prepareStart方法([wiki第8条](https://github.com/apache/rocketmq-spring/wiki/%E5%B8%B8%E8%A7%81%E9%97%AE%E9%A2%98))中setInstanceName设置不同的instanceName来解决。


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [rocketmq-spring] kengan commented on issue #339: Why the consumer can not consume the message about a cluster with two broker

Posted by GitBox <gi...@apache.org>.
kengan commented on issue #339:
URL: https://github.com/apache/rocketmq-spring/issues/339#issuecomment-770313455


   @maixiaohai  I can confirm that  this problem happen when start  consumer using docker container. The  root cause is two consumers have same instance clientId


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org