A custom topic category covers the topics for all devices in a product. This topic describes how to define a custom topic category for a product and how to use custom topics.

Background information

For information about how to define and use topics, see Topics.

Add a custom topic category

  1. Log on to the IoT Platform console.
  2. On the Overview page, find the instance that you want to manage and click the instance name to go to the Instance Details page.
    Important Enterprise Edition instances are available in the China (Shanghai) and Japan (Tokyo) regions. If the Enterprise Edition instances are unavailable in the region that you select, skip this step.
    Overview
  3. In the left-side navigation pane, choose Devices > Products.
  4. On the Products page, find the product for which you want to add a custom topic category and click View.
  5. On the Product Details page, choose Topic Categories > Topic Category > Edit Topic Category.
  6. Set the parameters and click OK.
    Custom topics
    Parameter Description
    Device Operation Authorizations The permission of the device on the topic category. Valid values: Publish, Subscribe, and Publish and Subscribe.
    Topic Category The name of the topic category. The name can contain letters, digits, and underscores (_). Each field of the topic category cannot be empty.
    Note If you set the Device Operation Authorizations parameter of a topic category to Subscribe, you can specify the plus sign (+) and number sign (#) wildcard characters in the topic category to allow devices to subscribe to multiple topics at the same time. For more information about how to use wildcard characters, see Custom topics with one or more wildcard characters.
    Description The description of the topic category. You can configure this parameter to distinguish the features of different topic categories.

Manage topic categories

On the Topic Category tab, find a custom topic category. You can perform multiple operations on the topic category. The following table describes the operations.

Operation Procedure
Edit
  1. Click Edit in the Actions column.
  2. In the Edit Topic Category dialog box, modify the Device Operation Authorizations and Topic Category parameters.
  3. Click OK.
Delete
Warning After you delete a custom topic category, communication services that are related to the custom topic category become unavailable. This way, your business is interrupted. Proceed with caution.
  1. Click Delete in the Actions column.
  2. In the message that appears, click OK.

Custom topics with one or more wildcard characters

If you set the Device Operation Authorizations parameter to Subscribe, IoT Platform allows you to specify the following wildcard characters in a topic. This feature allows a device to subscribe to multiple topics at the same time.

Wildcard character Description
# This wildcard character must be specified for the last field in a topic and can match all field values at the current level and sub-levels.

For example, you create the /a1aycMA****/${deviceName}/user/# topic category. If Device 1 subscribes to the /a1aycMA****/device1/user/# topic, the device subscribes to all topics that start with /a1aycMA****/device1/user/, including /a1aycMA****/device1/user/update and /a1aycMA****/device1/user/update/error.

+ This wildcard character can match all field values at the current level.

For example, you create the /a1aycMA****/${deviceName}/user/+/error topic category. If Device 1 subscribes to the /a1aycMA****/device1/user/+/error topic, the device subscribes to multiple topics, such as /a1aycMA****/device1/user/get/error and /a1aycMA****/device1/user/update/error.

A topic that includes one or more wildcard characters represents a set of topics. A device can subscribe to the topic. However, on the Topic List tab of the Device Details page, the Publish Message action is unavailable for the topic. You cannot send messages to the device by using the topic.

Use custom topics for communication

  • From IoT Platform to devices

    IoT Platform calls the Pub API operation to publish messages to a specified topic. Devices receive messages from IoT Platform by subscribing to the topic.

  • From devices to IoT Platform

    A device publishes messages to a custom topic. IoT Platform can receive messages from the device by using an Advanced Message Queuing Protocol (AMQP) server-side subscription or the data forwarding feature.

For more information about topic-based communication, see Use custom topics for communication.