Updated on 2024-11-06 GMT+08:00

MQTT Server Configuration

This topic describes how to set and manage MQTT server subscription on the IoT platform.

  1. Access the IoTDA service page and click Access Console. Click the target instance card.
  2. In the navigation pane, choose Rules > Data Forwarding, and click Create Rule on the left.

    Figure 1 Data forwarding - Creating a rule

  3. Set the parameters based on the table below and click Create Rule.

    Table 1 Parameters for creating a rule

    Parameter

    Description

    Rule Name

    Name of the rule to be created.

    Description

    Description of the rule.

    Data Source

    • Device: Device information, such as device addition, deletion, and update, will be forwarded. When Data Source is set to Device, quick configuration is not supported.
    • Device property: A property value reported by a device in a resource space will be forwarded. Click Quick Configuration on the right and select the product, property, and service data to forward.
    • Device message: A message reported by a device in a resource space will be forwarded. Click Quick Configuration on the right and select data of a specified topic to forward. Select the product to which the topic belongs and enter the topic name. You can use a custom topic on the product details page or a preset topic.
    • Device message status: The status of device messages exchanged between the device and platform will be forwarded. For details on the device message status, see Message Delivery Status. When Data Source is set to Device message status, quick configuration is not supported.
    • Device status: The status change of a directly or an indirectly connected device in a resource space will be forwarded. Click Quick Configuration on the right to forward information about devices whose status is Online, Offline, or Abnormal to other services. For details on the status of devices directly connected to the platform, see Device Management.
    • Batch task: The batch task status will be forwarded. When Data Source is set to Batch Task, quick configuration is not supported.
    • Product: Product information, such as product addition, deletion, and update, will be forwarded. When Data Source is set to Product, quick configuration is not supported.
    • Asynchronous command status of the device: Status changes of asynchronous commands to devices using LwM2M over CoAP will be forwarded. For details on the asynchronous command status of devices, see Asynchronous Command Delivery. When Data Source is set to Asynchronous command status of the device, quick configuration is not supported.
    • Run log: Service run logs of MQTT devices will be forwarded. When Data Source is set to Run log, quick configuration is not supported.

    Trigger

    After you select a data source, the platform automatically matches trigger events.

    Resource Space

    You can select a single resource space or all resource spaces. If All resource spaces is selected, quick configuration is not supported.

  4. Under Set Forwarding Target, click Add. On the displayed page, set the parameters based on the table below and click OK.

    Parameter

    Description

    Forwarding Target

    Select MQTT message queue.

    Push Topic

    Enter the MQTT topic to which data is forwarded.

    • The topic queue name can be customized and must be unique under an account. It can contain up to 128 characters. Use only letters, digits, underscores (_), hyphens (-), and slashes (/).
    • The topic that is used for the first time belongs to the resource space selected during rule creation. The topic can be used only in the resource space. If All resource spaces is selected during rule creation, the topic can be used in all resource spaces.
    Figure 2 Creating a forwarding target - to an MQTT push message queue

  5. After the rule is defined, click Enable Rule to start forwarding data to the MQTT message queue.