昨天晚上同事碰到个问题,rocketMq 在test和dev环境创建的topic ,默认是自动创建的没有问题,但是在pre环境却不行。日志里面提示是
com.alibaba.rocketmq.client.exception.MQClientException: Send [5] times, still failed, cost [24]ms, Topic: astrict_driver_refresh_crowd, BrokersSent: [broker-a, broker-b, broker-a, broker-b, broker-a] See http://docs.aliyun.com/cn#/pub/ons/faq/exceptions&send_msg_failed for further details. at com.alibaba.rocketmq.client.impl.producer.DefaultMQProducerImpl.sendDefaultImpl(DefaultMQProducerImpl.java:577) at com.alibaba.rocketmq.client.impl.producer.DefaultMQProducerImpl.send(DefaultMQProducerImpl.java:1034) at com.alibaba.rocketmq.client.impl.producer.DefaultMQProducerImpl.send(DefaultMQProducerImpl.java:1028) at com.alibaba.rocketmq.client.producer.DefaultMQProducer.send(DefaultMQProducer.java:101) at com.zhuanche.common.rocketmq.CommonRocketProducer.publishMessage(CommonRocketProducer.java:69) at com.zhuanche.service.mpconfig.AstrictDriverRefreshCrowdService.refreshDriverCrowd(AstrictDriverRefreshCrowdService.java:74) at com.zhuanche.controller.config.AstrictDriverNotifyController$4.run(AstrictDriverNotifyController.java:101) at java.lang.Thread.run(Thread.java:745) Caused by: com.alibaba.rocketmq.client.exception.MQBrokerException: CODE: 17 DESC: topic[astrict_driver_refresh_crowd] not exist, apply first please! See http://rocketmq.apache.org/docs/faq/ for further details. at com.alibaba.rocketmq.client.impl.MQClientAPIImpl.processSendResponse(MQClientAPIImpl.java:345) at com.alibaba.rocketmq.client.impl.MQClientAPIImpl.sendMessageSync(MQClientAPIImpl.java:255) at com.alibaba.rocketmq.client.impl.MQClientAPIImpl.sendMessage(MQClientAPIImpl.java:236) at com.alibaba.rocketmq.client.impl.producer.DefaultMQProducerImpl.sendKernelImpl(DefaultMQProducerImpl.java:682) [dev@cn_bj_sjhl_docker-pre-g1_10-30-11-21 mp-config-rest_10.30.11.248]$ Connection to ops-jump1.01zhuanche.com closed by remote host.
就是没有找到对应的topic,按说应该是自动创建的,但是手动创建后仍然不行。
这好奇怪。 最后是通过添加了 instanceName 解决了,但是这里面的逻辑自己仍然没有理清楚。