All Products
Search
Document Center

IoT Platform:Forward data to a topic

Last Updated:Jun 10, 2026

Devices cannot subscribe to or publish messages on topics of other devices. Data Forwarding processes messages from one device topic with an SQL statement and forwards the results to another device topic, enabling M2M communication.

How it works

Data Forwarding routes data from Topic 1 to Topic 2. The following figure shows the data flow.

image

Data Forwarding routes messages from Topic 1 of Device 1 to Topic 2 of Device 2. Device 2 must have subscribe permission on Topic 2 to receive the forwarded messages.

In the figure:

  • Source topic 1: The message types that Topic 1 supports are described in Data formats.

  • SQL statement: Write an SQL statement to parse and process device-reported JSON data. For SQL syntax, see SQL statements.

    Note

    Data in binary format is not parsed and is forwarded as-is.

  • Data destination: Topic 2, which receives messages from Topic 1. Supported topic types:

    Custom topics and downstream Thing Specification Language (TSL) data topics: /sys/${productKey}/${deviceName}/thing/service/property/set.

Use cases

  • Custom topic:

    • Communication between devices within the same product.

    • Communication between devices across different products.

  • Downstream TSL data topic: /sys/${productKey}/${deviceName}/thing/service/property/set.

    The device receives forwarded data from this topic and sets property values based on the message payload.

Limitations

  • The destination topic must have subscribe permission, and the destination device must subscribe to that topic. Otherwise, forwarded messages cannot be received.

  • Data Forwarding (Previous Version) does not support products and devices of Cloud Gateway or MQTT-based instances. Use Data Forwarding (New Version) instead.

Prerequisites

A data forwarding rule with an SQL statement is configured. Configure a data forwarding rule.

Add a data destination

  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 ID or instance name.

  3. In the left-side navigation pane, choose Message Forwarding > Data Forwarding.

  4. Click View next to the target rule. The Data Forwarding Rule page appears.

    Important

    If the Data Forwarding (New Version) page is displayed, click Back to Previous Version in the upper-right corner, then click View next to the target rule.

  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, configure the parameters, and click OK.

    Parameter

    Description

    Select operation

    Select Publish Data to Another Topic.

    Topic

    Select the destination topic.

    Valid values:

    • Custom: A custom topic. The device operation permission must be set to Subscribe so devices can receive forwarded messages.

    • Send Downstream TSL Data: The topic for setting device property values: thing/service/property/set. Devices receive forwarded data and set property values accordingly.

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

    Important

    If a device does not subscribe to the destination topic, it cannot receive forwarded messages.

    For example, if Device A connects to IoT Platform through MQTT.fx, it does not automatically subscribe to device topics. If Device B forwards data to the thing/service/property/set topic of Device A without Device A subscribing to it, Device A cannot receive the message.

    For automatic topic subscriptions, see Auto-subscribed topics.

  7. On the Data Forwarding page, find the rule and click Start in the Actions column.

Related documentation

FAQ