本文主要是介绍springboot集成rocketmq 创建topic并对此topic发送消息 No route info of this topic解决,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
测试时会报错:
com.alibaba.rocketmq.client.exception.MQClientException: No route info of this topic, TopicTest1
See http://docs.aliyun.com/cn#/pub/ons/faq/exceptions&topic_not_exist for further details.at com.alibaba.rocketmq.client.impl.producer.DefaultMQProducerImpl.sendDefaultImpl(DefaultMQProducerImpl.java:542)at com.alibaba.rocketmq.client.impl.producer.DefaultMQProducerImpl.send(DefaultMQProducerImpl.java:1030)at com.alibaba.rocketmq.client.impl.producer.DefaultMQProducerImpl.send(DefaultMQProducerImpl.java:989)at com.alibaba.rocketmq.client.producer.DefaultMQProducer.send(DefaultMQProducer.java:90)at com.yang.rocketmq.Producer.main(Producer.java:45)at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)at java.lang.reflect.Method.invoke(Method.java:606)at com.intellij.rt.execution.application.AppMain.main(AppMain.java:147)
解决方案
DefaultMQProducer producer = new DefaultMQProducer("please_rename_unidcque_group_name");
//设置自动创建topic的key值
producer.setCreateTopicKey("AUTO_CREATE_TOPIC_KEY");
//设置自动创建topic的key值
producer.setCreateTopicKey(“AUTO_CREATE_TOPIC_KEY”);
这一步很重要
吃水不忘挑水人 参考链接
这辈子坚持与不坚持都不可怕,怕的是独自走在坚持的道路上!!!
这篇关于springboot集成rocketmq 创建topic并对此topic发送消息 No route info of this topic解决的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!