All Products
Search
Document Center

IoT Platform:Server-side subscriptions

Last Updated:Dec 26, 2023

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

Scenarios

Server-side subscriptions can be used in the following scenarios:

  • Your server receives upstream messages from a large number of devices at the same time.

  • Your server receives subscribed messages from all devices of a product.

Note

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 differences between server-side subscriptions and data forwarding, see Compare data forwarding solutions.

Use an Advanced Message Queuing Protocol (AMQP) server to subscribe to device messages

After you configure an AMQP server-side subscription, IoT Platform forwards all subscribed device messages of a product to your server over AMQP.

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

image

Benefits of AMQP server-side subscriptions:

  • 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.

    Note

    If multiple consumer groups subscribe to the messages of Product B, the consumer groups can receive the same messages from Product B at the same time.

  • Facilitates troubleshooting. Server-side subscriptions allow you to view the client status, accumulated messages, and message consumption rate.

  • Supports linear scalability. You can significantly improve the message forwarding capability by adding consumer clients.

  • Pushes real-time messages first. Message accumulation does not affect the service.

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

    Even if messages are accumulated due to client failures or low consumption rates, real-time messages are sent together with accumulated messages after the clients recover. Then, devices can push messages in real time again.

Before you use an AMQP server-side subscription, you must configure it in the console. For more information, see Configure an AMQP server-side subscription. 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.

Note

After you use an 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.

Use the MNS server to subscribe to device messages

After you configure an MNS server-side subscription, IoT Platform forwards subscribed messages to Message Service (MNS) queues. The MNS client on your server receives device messages by listening to the MNS queues.

The following figure shows how messages are forwarded by using an MNS server-side subscription.

image

For information about how to configure an 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, see the MNS documentation.