question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

No route info of this topic problem

See original GitHub issue

clinet exception:

org.apache.rocketmq.client.exception.MQClientException: No route info of this topic, ffff
See http://rocketmq.apache.org/docs/faq/ for further details.
	at org.apache.rocketmq.client.impl.producer.DefaultMQProducerImpl.sendDefaultImpl(DefaultMQProducerImpl.java:634)
	at org.apache.rocketmq.client.impl.producer.DefaultMQProducerImpl.send(DefaultMQProducerImpl.java:1253)
	at org.apache.rocketmq.client.impl.producer.DefaultMQProducerImpl.send(DefaultMQProducerImpl.java:1203)
	at org.apache.rocketmq.client.producer.DefaultMQProducer.send(DefaultMQProducer.java:214)
	at com.xx.rmq.Producer.main(Producer.java:55)

rocketmq server config:

autoCreateTopicEnable=true

问题: 我们手动在rokcetmq中创建topic时,客户端访问时正常的,如果不提前手动创建将会出现上面的异常,如果需要让服务端自动创建topic,应该如何设置

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:37 (13 by maintainers)

github_iconTop GitHub Comments

25reactions
JerryChincommented, Jul 9, 2019

历时一天终于跑起来了,回顾官网起步教程中存在的各种坑:

坑爹 # 1

启动 Broker

nohup sh bin/mqbroker -n localhost:9876 & tail -f ~/logs/rocketmqlogs/broker.log The broker[%s, 172.30.30.233:10911] boot success…

很遗憾,上述方式直接忽略指定 Name Server 的步骤,导致 Name Server 不知道 Broker 的存在。

解决方案

编辑 conf/broker.conf

namesrvAddr = YOUR_NAME_SERVER_IP:PORT

使用以下指令启动 Broker

nohup sh bin/mqnamesrv -c conf/broker.conf & tail -f ~/logs/rocketmqlogs/namesrv.log The broker[broker-a, 192.168.3.211:10911] boot success. serializeType=JSON and name server is 192.168.3.211:9876 (我自己的输出结果,应该跟你的有出入)

坑爹 No route info of this topic # 2

RocketMQ 并不会自动创建 TopicTest,因此你必须手动创建该 Topic。

解决方案

bin\mqadmin updateTopic  -n YOUR_NAME_SERVER_IP:PORT -b YOUR_BROKER_IP:PORT -c DefaulCluster -o true -p 6 -r 8 -s true -t TopicTest -w 8

坑爹 No route info of this topic # 3

还是遇到这个错误?! 你是不是参考了以下官方示例?

public class AsyncProducer {
    public static void main(String[] args) throws Exception {
        //Instantiate with a producer group name.
        DefaultMQProducer producer = new DefaultMQProducer("please_rename_unique_group_name");
        // Specify name server addresses.
        producer.setNamesrvAddr("localhost:9876");
        //Launch the instance.
        producer.start();
        producer.setRetryTimesWhenSendAsyncFailed(0);
        for (int i = 0; i < 100; i++) {
                final int index = i;
                //Create a message instance, specifying topic, tag and message body.
                Message msg = new Message("TopicTest",
                    "TagA",
                    "OrderID188",
                    "Hello world".getBytes(RemotingHelper.DEFAULT_CHARSET));
                producer.send(msg, new SendCallback() {
                    @Override
                    public void onSuccess(SendResult sendResult) {
                        System.out.printf("%-10d OK %s %n", index,
                            sendResult.getMsgId());
                    }
                    @Override
                    public void onException(Throwable e) {
                        System.out.printf("%-10d Exception %s %n", index, e);
                        e.printStackTrace();
                    }
                });
        }
        //Shut down once the producer instance is not longer in use.
        producer.shutdown();
    }
}

以上代码创建完成 Producer 之后,立即调用 shutdown(),导致异步操作失败,最终抛出一个风马牛不相及的异常 No route info of this topic

org.apache.rocketmq.client.exception.MQClientException: No route info of this topic, TopicTest

解决方案

注释掉 producer.shutdown(); 即可。

坑爹 # 4

RocketMQ 内部代码一行注释看不到,我也是服气了。

7reactions
jimgreen2013commented, Aug 29, 2019

hi~ @duhenglucky i am new to rocketmq. RocketMQ is cool and become more and more popular, so i’d like to help you guys to make the quick start more friendly to newbies like me. If there are some errors in my statement, please point out. here we go, after some investigation, these are what i find:

  • the Start Broker part is fine, because parameter -n locolhost:9876 set the name server.As that’s a quick start, if you can put that in configuration file by default, that will be really nice.
  • No route info of this topic problem error. If i use the same 4.3.0 version client as the official site Simple Example page suggests, the broker(version 4.4.0) won’t create topic automatically. however 4.4.0 version client works! My suggestions are:
    1. modify the official site simple example page, modify the client version to 4.4.0
    2. As that’s a quick start for newbie like me, add the autoCreateTopicEnable = true to broker config file by default
    3. maybe you can check the code and find the real cause for this bug
  • all quick start examples should set name server by default,add some code like producer.setNamesrvAddr("localhost:9876")
  • default broker jvm memory configuration is -Xms8g -Xmx8g -Xmn4g, that’s almost kill my poor computer… i think you can make it smaller for our poor personal computer~ The professional company guys will configure that option by themselves.
Read more comments on GitHub >

github_iconTop Results From Across the Web

org.apache.rocketmq.client.exception.MQClientException: No ...
我的client版本是4.4.0,我的server版本是4.6.0。发消息的时候报了No route info of this topic的错,以下是报错日志:
Read more >
Rocketmq之No route info of this topic解决思路 - 腾讯云
This happens when you are trying to send messages to a topic whose routing info is not available to the producer. Make sure...
Read more >
Rocket MQ报错No route info of this topic的问题探究 - 博客园
MQClientException : No route info of this topic, TopicTest. See http: //rocketmq.apache.org/docs/faq/ for further details.
Read more >
java - How to fix 'No topic route info in name server for the ...
How to fix 'No topic route info in name server for the topic' exception in RocketmqClient ... I'm using apache-rocketmq to send message,but...
Read more >
RocketMQ 报No route info of this topic_猿芯的博客
MQClientException : No route info of this topic See http://rocketmq.apache.org/docs/faq/ for further details. at ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found