I want to learn the message queue of the system recently. We started with RocketMQ and ran it according to the demo on the official website. As a result, the Producer sent a message indicating an error: No route info of this topic

The Quick Start version is 4.7.1, but the Simple Message Example version is 4.7.1

<dependency> <groupId>org.apache.rocketmq</groupId> <artifactId>rocketmq-client</artifactId> <! -- The version here needs to be changed4.71.Be consistent with the version of the server (broker and NamesRV) --> <version>4.3. 0</version> 
</dependency>
Copy the code

A consistent version is required to create a topic by default and send messages if the topic does not exist.

To understand why, it’s important to understand the various concepts of RocketMQ.

  • Nameserver naming service, which stores topic information
  • A logical collection of topic messages
  • Broker class, the actual storage unit that can store messages for multiple topics
  • MessageQueue a collection of messages stored in the broker and belonging to a topic
  • Message is stored in messageQueue
  • Message producer
  • Consumer message

Details can be found on the official website

Going back to our problem, the actual reason for the failure of automatic creation of topics due to inconsistency of versions is that the names of the preset topics differ from version to version. Regardless of the physical structure, RocketMQ’s logical storage structure is producer/ Consumer -> Nameserver -> Topic -> messageQueue -> broker This means that the Nameserver needs to find specific broker information through the topic. This is where the predefined topic is used to find all broker information that allows automatic creation of a topic. This is the routing information in the error message