You can use the rules engine to forward data to DataHub. Then, you can forward the data from DataHub to Realtime Compute for Apache Flink or MaxCompute for computing.
Prerequisites
An IoT Platform instance whose data can be forwarded to Message Queue for Apache RocketMQ is created in a region that supports data forwarding DataHub.
Supported instances
Supported regions
Standard and Exclusive Enterprise Edition instances
Singapore
Public instances
Singapore
A DataHub project and a topic that is used to receive data are created. For more information about how to use DataHub, see Manage projects.
ImportantIf you use an Enterprise Edition instance, the DataHub project must reside in the same region in which the Enterprise Edition instance resides.
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.
Usage notes
You can use the new version or previous version of the data forwarding feature to forward data to DataHub. For more information about examples on how to use the new version of the data forwarding feature, see Use the new version of the data forwarding to forward data to DataHub.
Procedure
- Log on to the IoT Platform console.
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.
- In the left-side navigation pane, choose .
- Click View next to the rule that you want to manage. The Data Forwarding Rule page appears. Important 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.
- In the Forward Data section, click Add Operation.
In the Add Operation dialog box, configure the parameters as prompted and click OK. The following table describes the parameters.
Parameter
Description
Operation
Select Send Data to DataHub from the drop-down list.
Region
Select a region where DataHub is activated.
Project
Select a DataHub project.
You can click Create Project to go to the DataHub console and create a project. For more information, see Manage projects.
Topic
Select a DataHub topic to receive data.
After you select a topic, the rules engine automatically obtains the schema of the topic. Data that is sifted by the rules engine is mapped to the schema.
NoteData must be mapped to the schema in the
${}
format. Otherwise, a constant is stored to a schema table.The schema must use the same data type as the rules engine. Otherwise, data cannot be stored.
You can click Create Topic to go to the DataHub console and create a topic.
Roles
Grant IoT Platform the permissions to write data to DataHub.
If no RAM roles exist, click Create RAM Role to go to the Resource Access Management (RAM) console, create a RAM role, and then grant permissions to the RAM role. For more information, see Create a RAM role.
- Go to the Data Forwarding page, find the rule that you managed, and then click Start in the Actions column of the rule.
Examples
Use the Alibaba Cloud big data platform to create a dashboard to monitor devices