All Products
Search
Document Center

ApsaraMQ for RocketMQ:Manage topics

更新時間:Dec 03, 2024

In ApsaraMQ for RocketMQ, a topic is a first-level identifier that is used to classify messages. ApsaraMQ for RocketMQ supports the publish-subscribe (pub/sub) model. In this model, message publication and subscription are implemented based on topics. Producers send messages to topics and consumers subscribe to topics to consume messages. This topic describes how to create and delete an instance in the ApsaraMQ for RocketMQ console. This topic also describes how to update the information about a topic and view the details of a topic in the console.

Usage notes

  • A topic cannot be used across instances. For example, Topic A created on Instance A cannot be used on Instance B.

  • The message type of a topic must be consistent with the type of messages that the topic sends and receives. For example, if you create a topic to send and receive normal messages, you must specify normal messages as the message type of the topic when you create the topic. Otherwise, O&M issues, such as the loss of scheduled messages during endpoint change or instance migration, may occur.

Billing rules

You are charged topic occupancy fees for each created topic in ApsaraMQ for RocketMQ, regardless of whether you use the topic. We recommend that you delete topics that you no longer require at the earliest opportunity. For more information, see Billing of the messaging feature and Billing.

Naming rules for topics

  • A topic name must be 3 to 64 characters in length and can contain only letters, digits, hyphens (-), and underscores (_).

  • If the instance to which a topic belongs contains a namespace, the topic name must be unique in the instance. The name cannot be the same as an existing topic name or a group ID in the instance. Topic names and group IDs in different instances can be the same. For example, a topic name in Instance A can be the same as a topic name or group ID in Instance B.

  • If the instance to which the topic belongs does not contain a namespace, the topic name must be globally unique across instances and regions. The name cannot be the same as an existing topic name or group ID in ApsaraMQ for RocketMQ in your Alibaba Cloud account.

Note

You can check whether an instance contains a namespace in the Basic Information section of the Instance Details page in the ApsaraMQ for RocketMQ console.

Create a topic

  1. Log on to the ApsaraMQ for RocketMQ console. In the left-side navigation pane, click Instances.

  2. In the top navigation bar, select a region, such as China (Hangzhou). On the Instances page, click the name of the instance that you want to manage.

  3. In the left-side navigation pane, click Topics. In the upper-left corner of the page that appears, click Create Topic.

  4. In the Create Topic panel, configure the Name, Description, and Message Type parameters and click OK.

    Important

    You can use a topic to send and receive only messages of a specific type. For example, if you set the Message Type parameter to Normal Message when you create a topic, you can use this topic to send and receive only normal messages. For more information, see Message types.

    创建Topic

Delete a topic

Warning

After you delete a topic, producers cannot send messages to the topic and consumers cannot consume messages from the topic. The metadata and messages in the topic are also deleted and cannot be restored. Exercise caution when you delete a topic.

  1. On the Instances page, click the name of the instance that you want to manage. In the left-side navigation pane of the page that appears, click Topics.

  2. In the topic list, find the topic that you want to manage, click More in the Actions column, and then select Delete from the drop-down list.

  3. In the message that appears, click OK.

Update the information about a topic

  1. On the Instances page, click the name of the instance that you want to manage. In the left-side navigation pane of the page that appears, click Topics.

  2. In the topic list, find the topic that you want to manage and click Details in the Actions column. The Topic Details page appears.

  3. In the Basic Information section, click Edit next to the Topic Description field, enter a new topic description in the field, and then click OK.更新Topic

View the details of a topic

  1. On the Instances page, click the name of the instance that you want to manage. In the left-side navigation pane of the page that appears, click Topics.

  2. In the topic list, click the name of the topic that you want to manage or click Details in the Actions column corresponding to the topic.

References

You can also call the following API operations to manage topics: