All Products
Search
Document Center

IoT Platform:Create a data source

Last Updated:Nov 21, 2023

You can use the data forwarding feature of the rules engine of IoT Platform to forward data from a specified topic to other topics or other Alibaba Cloud services. This topic describes how to add topics to a data source.

Background Information

When you configure a data forwarding parser, you must associate the parser with topics from which data is forwarded. You can add up to 1,000 topics to a data source.

You can specify the topic(n) function in a parser script to obtain the topic from which data is forwarded. For more information, see Functions.

Create a data source

  1. Log on to the IoT Platform console.
  2. On the Overview page, click All environment. On the All environment tab, 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. In the upper-right corner of the Data Forwarding page, click Go to New Version to go to the new version.

    Note

    If you have performed this step, the Data Forwarding page of the new version appears after you choose Message Forwarding > Data Forwarding.

  5. Click the Data Source tab. On the Data Source tab, click Create Data Source.

  6. Enter a data source name and description. Then, click OK.

    The name must be 1 to 30 characters in length, and can contain letters, digits, underscores (_), and hyphens (-).

    The Data Source Details page appears. You can click Edit in the upper-right corner to modify the name and description of the data source.数据源详情

  7. On the Data Source Details page, click Add Topic. In the dialog box that appears, select the topic whose messages you want to process, and then click OK.

    The following table describes the supported topics.

    Important

    If you use cloud gateway products and devices, you can select only custom topics, Device Status Change Notification topics, and Device Changes Throughout Lifecycle topics. For more information about message forwarding topics and data formats, see Messaging over open source MQTT, Messaging over JT/T 808, and Messaging over GB/T 32960.

    Table 1. Topics

    Topic

    Description

    References

    Custom

    The topic that is used to forward data in custom formats. The format of this topic is the same as the format of a custom topic. Format: /${productKey}/${deviceName}/user/${TopicShortName}.

    ${TopicShortName} specifies a custom topic category, which is the suffix of the custom topic.

    The value can contain wildcard characters, including plus signs (+) and number signs (#).

    • All equipment (+): indicates all devices of the specified product.

    • /user/#: indicates all topics of the specified device.

    Use custom topics for communication

    Device Status Change Notification

    The topic that is used to forward notifications when the status of a device changes between online and offline. Format: /as/mqtt/status/${productKey}/${deviceName}.

    Submit device status

    TSL Data Reporting

    The following topics are provided:

    • /${productKey}/${deviceName}/thing/event/property/post: This topic is used to forward device properties.

    • /${productKey}/${deviceName}/thing/event/${tsl.event.identifier}/post: This topic is used to forward device events.

    • /${productKey}/${deviceName}/thing/property/batch/post: This topic is used to forward device properties in batches.

    • /${productKey}/${deviceName}/thing/event/batch/post: This topic is used to forward device events in batches.

    • /${productKey}/${deviceName}/thing/downlink/reply/message: This topic is used to forward messages that a device returns as responses to IoT Platform commands.

    The following topics are used to submit raw device data:

    • /sys/${productKey}/${deviceName}/thing/event/property/post: This topic is used to submit device properties.

    • /sys/${productKey}/${deviceName}/thing/event/${tsl.event.identifier}/post and /sys/${productKey}/${deviceName}/thing/event/${tsl.functionBlockId}:{tsl.event.identifier}/post: These topics are used to submit device events.

    • /sys/${productKey}/${deviceName}/thing/event/property/batch/post: This topic is used to submit device properties and events in batches.

    Device Changes Throughout Lifecycle

    The topic that is used to forward messages when a device is created, deleted, disabled, or enabled. Format: /${productKey}/${deviceName}/thing/lifecycle.

    Submit lifecycle changes

    Sub-Device Data Report Detected by Gateway

    The topic that is used to submit and forward the information about a new sub-device when a gateway detects the sub-device. This topic is specific to gateways. Format: /${productKey}/${deviceName}/thing/list/found

    Submit information about detected sub-devices

    Device Topological Relation Changes

    The topic that is used to forward notifications when topological relationships between sub-devices and the gateway are created or deleted. This topic is specific to gateways. Format: /${productKey}/${deviceName}/thing/topo/lifecycle.

    Device Topological Relation Changes

    /sys/${productKey}/${deviceName}/thing/topo/change: This topic is used to submit device data.

    Notify gateways of changes of topological relationships

    Device tag change

    The topic that is used to forward messages when device tags are changed. Format: /${productKey}/${deviceName}/thing/deviceinfo/update.

    Submit device tag changes

    /sys/${productKey}/${deviceName}/thing/deviceinfo/update: This topic is used to submit device data.

    Submit tags

    TSL Historical Data Reporting

    The following topics are provided:

    • /${productKey}/${deviceName}/thing/event/property/history/post: This topic is used to forward historical properties.

    • /${productKey}/${deviceName}/thing/event/${tsl.event.identifier}/history/post: This topic is used to forward historical events.

    /sys/${productKey}/${deviceName}/thing/event/property/history/post: This topic is used to submit historical TSL data.

    Device properties, events, and services

    Device status notification

    The following topics are provided:

    • /${productKey}/${deviceName}/ota/upgrade: This topic is used to forward over-the-air (OTA) update results.

    • /${productKey}/${deviceName}/ota/progress/post: This topic is used to forward the progress of updates.

    The preceding topics correspond to the following topic: /ota/device/progress/${productKey}/${deviceName}. This topic is used to submit update progress.

    Submit the update progress to IoT Platform

    Submit a module version number

    The topic that is used to forward messages when the version number of an OTA module for a device is changed. Format: /${productKey}/${deviceName}/ota/version/post.

    Submit OTA module versions

    The preceding topic corresponds to the following topic: /ota/device/inform/${productKey}/${deviceName}. This topic is used to submit the version number of an OTA module.

    Submit OTA module versions to IoT Platform

    Batch status notification

    The topic to which IoT Platform sends messages when the status of an OTA update batch changes. Format: /${productKey}/${packageId}/${jobId}/ota/job/status.

    Submit the status data of OTA update batches

    Job Event

    /sys/uid/${uid}/distribution/${jobId}/lifecycle: The topic that is used to forward notifications when the status of a device job changes.

    Note

    The name of the instance migration task is the same as the name of the product whose data you want to migrate.

    Submit the status data of data migration tasks for instances

  8. Optional. Repeat the preceding step to add multiple topics to the data source.

    You can delete topics on the Data Source Details page based on your business requirements.Topic列表

  9. Optional. Repeat Step 5 to Step 8 to create multiple data sources.

What to do next

Create a data destination