You can use the data forwarding feature of the rules engine to forward data to Function Compute. Then, Function Compute uses function scripts to process data.
- A Function Compute service and function are created. The function is configured and can run as expected after verification. For more information about how to use Function Compute, see the Function Compute documentation.
- A data forwarding rule is created and an SQL statement that is used to process data is written. For more information, see Configure data forwarding rules.
The following figure shows the data forwarding procedure.
The rules engine uses the data forwarding feature to forward device data to Function Compute. Then, Function Compute uses function scripts to process data. You can use business-specific function scripts to implement various features.
- Log on to the IoT Platform console.
- In the left-side navigation pane, choose .
- Click View next to the required rule. The Data Forwarding Rule page appears.
- In the Data Forwarding section, click Add Operation.
- In the Add Operation dialog box, select Send to Function Compute. Set the required parameters as prompted and click OK.
Parameter Description Select Operation Select Send to Function Compute. Region Select a region where Function Compute runs. Services Select a Function Compute service.
To create a service in the Function Compute console, click Create Service. For more information, see the Function Compute documentation.
Function Select a function that is used to receive data.
To create a function in the Function Compute console, click Create Function.
Authorization Authorize IoT Platform to write data to Function Compute.
- Go to the Data Forwarding page, find the required rule, and then click Start in the Actions column of the rule.
- Run a test.
Publish a message to the topic that is specified in the SQL statement of the rule. Then, log on to the Function Compute console and click the required function. On the Logs tab of the details page, view the execution logs. In the upper-right corner of the tab, click Monitoring. On the page that appears, view the monitoring history of the function. The system shows monitoring data about 5 minutes after the monitoring data is generated.