IoT Platform allows you to use a consumer group to subscribe to the messages of a topic and then forward the messages to an Advanced Message Queuing Protocol (AMQP) server. This topic describes how to configure and manage an AMQP server-side subscription in the IoT Platform console.

Prerequisites

A consumer group is created. This consumer group is used to subscribe to topic messages. You can use the default consumer group (DEFAULT_GROUP) or create a consumer group in IoT Platform. For more information, see Manage consumer groups.

Configure a subscription

To specify the type of messages to which you want to subscribe, perform the following steps:

  1. Log on to the IoT Platform console.
  2. On the Overview page, find the instance and click the instance name to go to the Instance Details page.
    Notice Enterprise Edition instances are available only in the China (shanghai) and Japan (Tokyo) region. If your IoT Platform is not activated in the China (shanghai) or Japan (Tokyo) region, skip this step.
    Overview
  3. In the left-side navigation pane, choose Rules > Server-side Subscription.
  4. On the Server-side Subscription page, click Create Subscription.
  5. In the Create Subscription dialog box, configure the parameters and click OK. The following table describes the parameters.
    Parameter Description
    Products Select the product to which the devices belong. The messages submitted by these devices are pushed to consumers.
    Subscription Type Select AMQP.
    Consumer Group Select consumer groups. You can specify multiple consumer groups for a product. You can also create multiple subscriptions to products by using a consumer group.

    IoT Platform provides a default consumer group to consume messages. To group consumers, perform the following steps to create a consumer group: In the lower-right corner of the Select Consumer Groups dialog box, click Create Consumer Group and set the required parameters. For more information about consumer groups, see Manage consumer groups.

    Message Type Select the types of messages. You can subscribe to the following types of device messages:
    • Device Upstream Notification: these messages in the topics whose Allowed Operations parameter is set to Publish. For more information, see What is a topic?.

      These messages include custom data and Thing Specification Language (TSL) data that is submitted by devices. The upstream TSL data includes property data, event data, responses to property setting requests, and responses to service calls. The TSL data that is pushed to user servers is processed by IoT Platform. For more information about data formats, see Data formats.

      For example, the following three topic categories are defined for a product:
      • /${YourProductKey}/${YourDeviceName}/user/get: The Allowed Operations parameter of this topic category is set to Subscribe.
      • /${YourProductKey}/${YourDeviceName}/user/update. The Allowed Operations parameter of this topic category is set to Publish.
      • /sys/${YourProductKey}/${YourDeviceName}/thing/event/property/post. The Allowed Operations parameter of this topic category is set to Subscribe.

      IoT Platform pushes messages of the following topic categories: /${YourProductKey}/${YourDeviceName}/user/update and /sys/${YourProductKey}/${YourDeviceName}/thing/event/property/post.

      Notice You may need to subscribe to response data of asynchronous service calls. In this case, the message ID returned by the device must be the same as the message ID generated when IoT Platform sends downstream data.
    • Device Status Change Notification: the notifications that devices send when the online or offline status changes.
    • Gateway's sub-devices discovery report: the sub-device data that gateways submit when these gateways detect new sub-devices. The gateways must have the applications that can be used to detect sub-devices. This message type is specific to gateways.
    • Device Topological Relation Changes: the notifications that gateways send when topological relationships between sub-devices and the gateways are created or deleted. This message type is specific to gateways.
    • Device Changes Throughout Lifecycle: the notifications that devices send when the devices are created, deleted, enabled, or disabled.
    • TSL Historical Data Reporting: the historical properties and events that are submitted by devices.
    • OTA Update Status Notification: the notifications that devices send during firmware verification and batch update. When a device update task succeeds, fails, is canceled, or is being implemented, a notification is pushed.
    • Device tag change: the messages that devices send when device tags change.
    • Submit a module version number: the messages that devices send when OTA module versions change.
    • Batch status notification: the notifications that devices send when the status of OTA update batches changes.
    Note When you listen to device messages, you may need to filter or process the messages. In this case, you can forward messages to an AMQP consumer group by using data forwarding rules. Then, you can receive the messages by using the AMQP client. For more information, see Data forwarding.

    For more information about how to forward messages to an AMQP server and the device topics to which you can subscribe, see Topics that are related to the rules engine and device communication.

What to do next

Configure an AMQP client: We recommend that you use the AMQP SDK provided by IoT Platform. Alibaba Cloud does not provide technical support for user-developed AMQP SDKs.

Note After the settings are configured and submitted device data is received by an AMQP client, you can view the operation logs in the IoT Platform console.Choose Maintenance > Device Log > Cloud run log. The log entries are generated when a device submits data, IoT Platform forwards the data to the AMQP client, and the AMQP client returns an ACK message.