You can forward the data that is processed by an SQL statement in a data forwarding rule to a topic. This implements machine-to-machine (M2M) communication or other communication scenarios.

Prerequisites

A data forwarding rule is created and an SQL statement that is used to process data is written. For more information, see Configure a data forwarding rule.

Background information

The data forwarding feature of the rules engine allows you to forward data from Topic 1 to Topic 2.

The following figure shows the data forwarding process.

Forward data to a topic

Procedure

  1. Log on to the IoT Platform console.
  2. On the Overview page, find the instance and click the instance name to go to the Instance Details page.
    Notice Enterprise Edition instances are available only in the China (shanghai) and Japan (Tokyo) region. If your IoT Platform is not activated in the China (shanghai) or Japan (Tokyo) region, skip this step.
    Overview
  3. In the left-side navigation pane, choose Rules Engine > Data Forwarding.
  4. Click View next to the rule that you want to manage. The Data Forwarding Rule page appears.
    Notice If the new version of the Data Forwarding page is displayed, click Back to Previous Version in the upper-right corner, and then click View in the Actions column of the rule that you want to manage.
  5. In the Forward Data section, click Add Operation.
  6. In the Add Operation dialog box, select Publish Data to Another Topic from the Operation drop-down list. Follow the instructions on the page to configure other parameters and click OK.
    Publish data to another topic
    Parameter Description
    Select Operation Select Publish Data to Another Topic.
    Topic Select a destination topic to which you want to forward data.

    Valid values:

    • Custom: specifies a custom topic as the destination topic. You must set the permission of the custom topic to subscribe. This allows devices to subscribe to the topic and obtain forwarded messages from the topic.
    • Send Downstream TSL Data: specifies a topic that is used by devices to receive commands as the destination topic. These commands are used to configure device properties. By default, the topic is thing/service/property/set. A device receives forwarded data from the topic. Then, the device configures the required property based on the received data. If you want to configure properties for the devices that subscribe to the destination topic based on the forwarded data, you can set the Topic parameter to this value.

    After you select a topic type, you must select a product, device, and topic.

    Notice If a device does not subscribe to the destination topic, the device cannot receive forwarded data.

    For example, if you use MQTT.fx to connect Device A to IoT Platform, Device A cannot automatically subscribe to device topics. If Device B forwards data to the thing/service/property/set topic and Device A does not subscribe to the topic, Device A cannot receive the data that is forwarded by Device B.

    For more information, see Automatic topic subscription.

  7. Go to the Data Forwarding page, find the rule that you managed, and then click Start in the Actions column of the rule.