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.
  2. In the left-side navigation pane, click Instances.
  3. In the top navigation bar, select a region such as China (Hangzhou).
  4. On the Instances page, click the name of the instance that you want to manage. The Instance Details page appears.
  5. In the left-side navigation pane, click Topics.
  6. On the Topics page, click Create Topic.
  7. In the Create Topic panel, configure the Name, Description, and Message Type parameters and click OK.
    Notice A topic can send or receive messages only of the specified type. For example, if the message type of the topic that you created is the normal message type, the topic cannot send or receive ordered 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 the topic is Creating, refresh the page until the status of the topic changes to Enabled. After the status is changed, you can use the topic.

Delete a topic

Notice After you delete a topic, the producers cannot send messages to the topic and the consumers cannot consume messages from the topic. The metadata and messages of the topic are also deleted and cannot be recovered. Exercise caution when you delete a topic.
  1. Log on to the Message Queue for Apache RocketMQ console.
  2. In the left-side navigation pane, click Instances.
  3. In the top navigation bar, select a region such as China (Hangzhou).
  4. On the Instances page, click the name of the instance that you want to manage. The Instance Details page appears.
  5. In the left-side navigation pane, click Topics.
  6. 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.
  7. In the dialog box that appears, click OK.
    On the Topics page, you cannot view the topic that you deleted.

Update a topic

  1. Log on to the Message Queue for Apache RocketMQ console.
  2. In the left-side navigation pane, click Instances.
  3. In the top navigation bar, select a region such as China (Hangzhou).
  4. On the Instances page, click the name of the instance that you want to manage. The Instance Details page appears.
  5. In the left-side navigation pane, click Topics.
  6. On the Topics page, find the topic that you want to update and click Details in the Actions column. The Topic Details page appears.
  7. 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. Log on to the Message Queue for Apache RocketMQ console.
  2. In the left-side navigation pane, click Instances.
  3. In the top navigation bar, select a region such as China (Hangzhou).
  4. On the Instances page, click the name of the instance that you want to manage. The Instance Details page appears.
  5. In the left-side navigation pane, click Topics.
  6. On the Topics page, find the topic whose details you want to view and click the topic name or click Details in the Actions column.
    On the Topic Details page, you can view the details of the topic.

More operations

On the Topics page, you can perform other related operations.

On the Topics page, find the topic that you want to manage, click More in the Actions column and select one of the following options from the drop-down list:
  • Quick Start: Send and receive messages in the console.
  • Permissions Reference: View the policies that you can use to manage topics in the Message Queue for Apache RocketMQ console. For more information, see Policies and examples.
  • Online Groups: View the online groups that subscribe to the topic.
  • Cloud Monitor: View the monitoring data for messages in the topic.
  • Message Production Chart: View the total number of messages that are produced in the topic. You can also view the transactions per second (TPS) of message production.
  • Message Consumption Chart: View the total number of messages that the topic sends to the online groups. You can also view the TPS of message delivery.
  • Query Messages: Create a query task to query the messages in the topic. For more information, see Query a message.

References

You can call the following API operations to manage topics: