All Products
Search
Document Center

IoT Platform:Shared subscription

Last Updated:Jun 18, 2026

MQTT 5.0 shared subscriptions allow you to deliver each message to only one subscriber within a group, enabling load balancing and task distribution across devices or servers.

Background information

MQTT is designed based on the publish-subscribe pattern. After a message is published, all subscribers receive the message. In some scenarios, you may want only one or several subscribers to receive specific messages. Shared subscriptions address this need. To use the feature, a subscriber must specify a shared subscription tag and join a subscriber group.

Note

Only one subscriber in a subscriber group receives each message.

image..png

In the preceding figure, Subscriber C and Subscriber D subscribe to the demo/topic topic through the standard process, and Publisher A publishes messages to the same topic. Subscriber A and Subscriber B use shared subscriptions, so messages are randomly delivered to one of them.

The shared subscription topic $share/group/demo/topic includes the following items:

  • Shared subscription tag: $share.

  • Subscriber group: group1. You must specify a value.

  • Original topic: demo/topic. You must specify a value.

IoT Platform identifies the subscription as a shared subscription belonging to subscriber group group1 based on the $share tag and the group name. Wildcard characters are supported. For example, to subscribe to all messages, you can use the $share/group1/# topic.

Limits

  • Shared subscriptions are available only for gateways of Exclusive Enterprise Edition instances and Standard MQTT-based instances.

  • When multiple subscribers in a subscriber group use shared subscriptions, IoT Platform randomly pushes messages to one of them.

  • Shared subscriptions are available only for devices connected to IoT Platform over MQTT 5.0. Devices connected over MQTT 3.1 cannot use shared subscriptions even if they comply with the shared subscription rules.

Scenarios

Server-side load balancing

When a large number of devices send messages to IoT Platform, you can use shared subscriptions to distribute messages across multiple business servers for load balancing. In the following figure, Business Server A and Business Server B belong to the same subscriber group. IoT Platform randomly pushes device messages to one of them.image..png

Note

Shared subscriptions are integrated into IoT Platform server-side subscriptions. IoT Platform can send messages to business servers over AMQP. For more information, see Server-side subscription.

Server-side task scheduling

You can use shared subscriptions for basic task scheduling by representing each task as a message. In the following figure, the devices are robots. The business server pushes a handling task. If one of the devices responds to the task, the shared subscription delivers it to only one of the robots.image..png