You can use the data forwarding feature of the rules engine to forward data to Tablestore.

Prerequisites

Create a data table

  1. Log on to the Tablestore console. In the top navigation bar, select the Japan (Tokyo) region.
    Important If you use an IoT Platform instance of the Enterprise Edition, the region where the Tablestore instance is deployed must be the same as that of the IoT Platform instance.
  2. Click Create Instance. In the Create Instance dialog box, enter an instance name, for example, IoTDataStore, and use the default values for other parameters. Then, click OK.
    For more information, see Create instances.
  3. On the Instance Details tab of the IoTDataStore instance, click Create Table. Enter a table name, for example, iot_data, and add the deviceName and timestamp primary keys. For more information, see Create tables.

Configure a data forwarding rule

  1. In the left-side navigation pane of the iotTest instance, choose Rules Engine > Data Forwarding.
  2. On the Data Forwarding page, click Create Rule.
    Important If the Data Forwarding page of the latest version appears, click Back to Previous Version in the upper-right corner of the page. When the Data Forwarding page of the previous version appears, click Create Rule.
  3. In the Create Data Forwarding Rule dialog box, enter a rule name, for example, Thermostat_Data_Forwarding, set the Data Type parameter to JSON, and then click OK.
  4. After the rule is created, the Data Forwarding Rules page appears. Perform the following steps to edit an SQL statement to process data and specify a data forwarding destination:
    1. Click Write SQL Statement. In the dialog box that appears, specify the SELECT field, set Topic to TSL Data Reporting, select the Home_Thermostat product and the Device1 device, select Default Module, select the thing/event/property/post topic, and then click OK.
      In this example, the following SELECT field is specified:
      items.temperature.value as temperature, items.humidity.value as humidity,deviceName() as deviceName,timestamp() as time

      For more information, see SQL statements and Functions.

      Write SQL Statement
    2. Click Add Operation in the Forward Data section. Set the data forwarding destination to the created data table iot_data. For more information, see Forward data to Tablestore.
  5. Go to the Data Forwarding page. Find the rule that you configured and click Start in the Actions column. After the rule is enabled, data is forwarded based on the rule.

    After the virtual device submits data, you can view the real-time data stored in the iot_data table of Tablestore, as shown in the following figure.

    You can also view the complete forwarding logs by using the Device Log feature of the Enterprise Edition instance to troubleshoot errors.

What to do next

Subscribe to device messages from IoT Platform