Creating a RocketMQ Topic
A topic is the basic unit for sending and receiving messages. After purchasing a RocketMQ instance, you must manually create a topic, and publish and subscribe messages. A message producer sends messages to this topic. A message consumer consumes messages by subscribing to this topic.
Notes and Constraints
- Topics cannot be used across instances. For example, topic A of instance A cannot be used in instance B.
- The topic type and message type (see Table 2) must be consistent when a client uses gRPC to send and receive messages for v5.x. For example, to create a topic for sending and receiving normal messages, the message type of this topic must be normal. Otherwise, node failover or scheduled message loss during instance migration may occur.
Prerequisites
A RocketMQ instance has been purchased.
Creating a Topic
- Log in to the console.
- Click
in the upper left corner to select a region.
DMS for RocketMQ instances in different regions cannot communicate with each other over an intranet. Select a nearest location for low latency and fast access.
- Click
and choose Middleware > Distributed Message Service for RocketMQ to open the console of DMS for RocketMQ.
- Click a RocketMQ instance to go to the instance details page.
- In the navigation pane, choose Instance > Topics.
- Click Create Topic.
- Configure the topic name and other parameters by referring to Table 1 or Table 2.
Figure 1 Creating a topic (RocketMQ 4.8.0)Figure 2 Creating a topic (RocketMQ 5.x)
Table 1 Topic parameters (RocketMQ 4.8.0) Parameter
Description
Topic Name
Name of the topic.
A topic name must meet the following requirements:- Contains 3 to 64 characters.
- Contains only letters, digits, percent signs (%), vertical bars (|), hyphens (-), and underscores (_).
A percent (%) or vertical bar (|) contained in a topic name will be converted to an underscore (_) by Cloud Eye. For example, if a topic name is test%01, it will be displayed as test_01 on Cloud Eye.
- Cannot start with rmq_sys_.
- Cannot be the same as the following strings:
- TBW102
- SCHEDULE_TOPIC_XXXX
- BenchmarkTest
- RMQ_SYS_TRANS_HALF_TOPIC
- RMQ_SYS_TRACE_TOPIC
- RMQ_SYS_TRANS_OP_HALF_TOPIC
- TRANS_CHECK_MAX_TIME_TOPIC
- SELF_TEST_TOPIC
- OFFSET_MOVED_EVENT
- The topic name must be unique. Otherwise, the topic cannot be created.
Once the topic is created, you cannot modify its name.
Permission
Permissions of a topic.
Options:
- Publish/Subscribe: Producers can send messages to this topic. Consumers can consume them from this topic.
- Publish: Producers can send messages to the topic. But consumers cannot consume them from this topic.
- Subscribe: Producers cannot send messages to this topic. But consumers can consume messages from this topic.
Default: Publish/Subscribe
Brokers
Specify the broker to create the topic on, and the number of queues in the topic.
If the instance is deployed on multiple brokers, click Add to add more brokers and set the number of queues in the topic.
To add associated brokers, increase the broker quantity. For details, see Modifying RocketMQ Specifications. Increasing the broker quantity increases the maximum topics supported. For example, increasing the broker quantity from 1 to 2 increases the maximum topics from 4,000 of one broker to 8,000 of two brokers.
Description
Topic description.
The value contains 0 to 200 characters.
- Click OK.
Related Documents
- To create a topic by calling an API, see Creating a Topic or Deleting Topics in Batches.
- To access RocketMQ on a client, see Accessing RocketMQ on a Client (Without SSL), Accessing RocketMQ on a Client (With SSL), or Accessing RocketMQ on the Console.
- To create multiple users and assign different topic permissions to them for user-isolated permissions, see Enabling RocketMQ ACL and Configuring RocketMQ ACL Users.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot