This topic describes how to create, delete, and update topics and view the details of a topic in the Message Queue for Apache RocketMQ console.

Background information

A topic is a first-level identifier that is used to classify messages in Message Queue for Apache RocketMQ. Message Queue for Apache RocketMQ supports the publish/subscribe pattern. Producers send messages to topics. Consumers subscribe to topics to consume messages.

Description

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

Billing rules

When you use Message Queue for Apache RocketMQ, you are charged for the resources that are used by each created topic. You are charged for the topics that you create regardless of whether you use the topics because the resources are allocated to the topics. We recommend that you delete the topics that you do not use at the earliest opportunity. For more information about billing rules, see Pricing details of the messaging feature.

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 that contains a topic 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 that contains a topic 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 Message Queue for Apache RocketMQ in your Alibaba Cloud account.
Note You can check whether an instance has a namespace in the Basic Information section on the Instance Details page in the Message Queue for Apache RocketMQ console.

Create a topic

  1. Log on to the Message Queue for Apache RocketMQ console and click Instances in the left-side navigation pane.
  2. In the top navigation bar, select a region. Example: China (Hangzhou). Then, click the ID of the instance that you want to manage.
  3. In the left-side navigation pane, click Topics. In the upper-left corner of the Topics page, click Create Topic.
  4. In the Create Topic panel, configure the Name, Description, and Message Type parameters and click OK.
    Important A topic can be used 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.
    Create a topic
    On the Topics page, you can view the topic that you created. topic_status_in_service
    Note If the value of the Status parameter for a topic is Creating, refresh the page until the status of the topic changes to Enabled. You can use a topic only after the status of the topic is changed.

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, find the instance whose topic you want to delete and click the instance ID. In the left-side navigation pane, click Topics.
  2. On the Topics page, find the topic that you want to delete, click More in the Actions column, and then select Delete from the drop-down list.
  3. In the dialog box that appears, click OK.
    On the Topics page, you can no longer view the topic that you deleted.

Update a topic

  1. On the Instances page, find the instance whose topic you want to update and click the instance ID. In the left-side navigation pane, click Topics.
  2. On the Topics page, find the topic that you want to update and click Details in the Actions column. The Topic Details page appears.
  3. In the Basic Information section, click Edit next to Topic Description. Modify the description of the topic in the field and click OK. Update a topic
    On the Topics page, you can view the new description of the topic.

Query a topic

  1. On the Instances page, find the instance whose topic details you want to view. In the left-side navigation pane, click Topics.
  2. On the Topics page, find the topic whose details you want to view and click the topic name or Details in the Actions column.
    On the Topic Details page, you can view the details of the topic.

References

You can call the following API operations to manage topics: