A server can subscribe to various types of product messages. These messages include device upstream messages, device status changes, gateway and sub-device connections, device lifecycle changes, and device topology changes. After you configure server-side subscription, IoT Platform forwards the subscribed messages from all devices of the product to your server.

Scenarios

Server-side subscription is ideal for scenarios in which device data is received from a large number of concurrent subscription tasks.

The server receives subscribed data from all devices of a product.

If you have multiple servers that consume messages from the same product, the messages are randomly forwarded to one of the servers.

For information about the difference between server-side subscription and rules engine data forwarding, see Compare data forwarding solutions.

Use an AMQP server to subscribe to device messages

AMQP refers to Advanced Message Queuing Protocol. After you configure AMQP server-side subscription, IoT Platform forwards all subscribed device messages of a product to your server over AMQP.

Note After you enable AMQP server-side subscription in the IoT Platform, you are billed based on the number of forwarded messages. For information about the billing methods, see Messaging fees.

The following figure shows how messages are forwarded in AMQP server-side subscription.

AMQP

Benefits of AMQP server-side subscription:

  • Supports multiple consumer groups. You can create multiple consumer groups for different environments. For example, you can create two consumer groups: Group A and Group B. Group A subscribes to the messages of Product A in the development environment and Group B subscribes to the messages of Product B in the production environment.
  • Facilitates troubleshooting. Server-side subscription allows you to view the client status, accumulated messages, and message consumption rate.
  • Supports linear scalability. If you have sufficient clients, the message forwarding can be linearly scale up.
  • Pushes real-time messages first. Message accumulation does not affect service.

    Real-time messages take precedence over accumulated messages if the push rate limit is reached or push failure occurs.

    Even if messages are accumulated due to client failures, real-time messages are sent together with accumulated messages after the client recovers. This ensures that the device becomes available again in the shortest possible time.

Before you use AMQP server-side subscription, you must configure it in the console. For more information, see Configure AMQP server-side subscription in the console. You must develop an AMQP client and connect it to IoT Platform. Then, you can use the client to receive messages. For more information, see Connect an AMQP client to IoT Platform.

Use the MNS server to subscribe to device messages

After you configure MNS server-side subscription, IoT Platform forwards subscribed messages to Message Service (MNS) queues. Your client then receives device messages by monitoring MNS queues.

The following figure shows how messages are forwarded in MNS server-side subscription.

MNS

For information about how to configure MNS server-side subscription, see Use Message Service (MNS) to subscribe to device messages.

Note You are billed based on the queues that you create and the messages that you receive. For more information about the billing methods, seeMessage Service documentation.