You can use the rules engine to forward messages from devices to IoT Platform. The messages are processed by using SQL statements, forwarded to AMQP consumer groups, and then consumed by AMQP clients.

Create consumer groups

  1. Log on to the IoT Platform console.
  2. In the left-side navigation pane, choose Rules > Server-side Subscription.
  3. On the Server-side Subscription page, choose Consumer Groups > Create Consumer Group.
  4. In the Create Consumer Group dialog box, enter a consumer group name and click OK.
    The name must be 4 to 30 characters in length, and can contain letters, digits, and underscores (_).
    After a consumer group is created, you can add a data forwarding operation and forward data to the consumer group.

Create a data forwarding operation

Before you can create a data forwarding operation, you must create a data forwarding rule and write an SQL statement to process data. For more information, see Configure data forwarding rules.

  1. On the Data Forwarding page, find the rule and click View.
  2. On the Data Forwarding Rule page, click Add Operation in the Data Forwarding section.
  3. Select Publish to AMQP Subscribed Consumer Group, set other parameters as prompted, and click OK.
    Parameter Description
    Select Operation Select Publish to AMQP Subscribed Consumer Group.
    Consumer Group Select a consumer group to which you want to forward data. You can click Create Consumer Group to create a consumer group.
    Tag If you set a tag, the tag will be attached to all messages that are forwarded by this operation to the AMQP consumer group.
    The tag must be 1 to 128 characters in length. You can specify a constant or a variable.
    • A constant can contain letters and digits.
    • If you specify a variable, use the format of ${key}. ${key} indicates that the variable references the value of a key in the JSON result of an SQL statement. If the value is unavailable, a tag is not attached to the messages.
  4. Go to the Data Forwarding page, find the rule and click Start in the Actions column to start the rule.

Configure an AMQP client to consume messages

After the data is forwarded to the AMQP consumer group, your server consumes the messages by using the AMQP client. For more information about how to configure an AMQP client, see AMQP client access instructions.

For sample code of the AMQP client implementation, see the following topics: