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

Background information

Message Queuing Telemetry Transport (MQTT) is a messaging protocol based on the publish-subscribe model. Therefore, each message belongs to a topic. MQTT supports multiple levels of topics. A level 1 topic is a parent topic. Before you use Message Queue for MQTT, you must create a parent topic in the Message Queue for MQTT console.

For more information, see Terms.

Usage notes

  • Topics cannot be used across instances. For example, you cannot use the endpoint of Instance B to subscribe to a topic that is created in Instance A.
  • A topic name must be 3 to 64 characters in length and can contain letters, digits, hyphens (-), and underscores (_).

Create a topic

  1. Log on to the Message Queue for MQTT console.
  2. In the left-side navigation pane, click Instances.
  3. In the top navigation bar, select a region.
  4. Find the instance for which you want to create a topic in the instance list. In the Actions column, choose More > Topics.
  5. In the upper-left corner of the Topics page, click Create Topic.
  6. In the Create Topic panel, set the Name and Description parameters for the topic and click OK in the lower-left corner.
    You can view the topic that you create on the Topics page.

Update the description of a topic

  1. Log on to the Message Queue for MQTT console.
  2. In the left-side navigation pane, click Instances.
  3. In the top navigation bar, select a region.
  4. Find the instance for which you want to update a topic in the instance list. In the Actions column, choose More > Topics.
  5. In the topic list, find the topic that you want to update. Click the topic name or click Details in the Actions column to go to the Topic Details page.
  6. In the Basic Information section, click Edit next to Description. In the field that appears, enter the new description. Then, click OK.
    You can view the topic description that you update on the Topics page.

Query the details of a topic

  1. Log on to the Message Queue for MQTT console.
  2. In the left-side navigation pane, click Instances.
  3. In the top navigation bar, select a region.
  4. Find the instance for which you want to query a topic in the instance list. In the Actions column, choose More > Topics.
  5. In the topic list, find the topic that you want to query. Click the topic name or click Details in the Actions column to go to the Topic Details page.
    On the Topic Details page, you can query the details of the specified topic.

Delete a topic

Notice After a topic is deleted, the producers stop sending messages to the topic and the consumers stop consuming messages from the topic. The metadata and messages of the topic are deleted and cannot be recovered. Therefore, exercise caution when you delete a topic.
  1. Log on to the Message Queue for MQTT console.
  2. In the left-side navigation pane, click Instances.
  3. In the top navigation bar, select a region.
  4. Find the instance for which you want to delete a topic in the instance list. In the Actions column, choose More > Topics.
  5. In the topic list, find the topic that you want to delete. In the Actions column, choose More > Delete.
  6. In the message that appears, click OK.
    On the Topics page, you cannot view the deleted topic.

References

You can also create data inbound or outbound rules for a topic. For more information, see Manage rules.