tencent cloud

Clustering Consumption and Broadcasting Consumption
Last updated:2026-01-23 17:52:23
Clustering Consumption and Broadcasting Consumption
Last updated: 2026-01-23 17:52:23
This document mainly introduces the features and scenarios of clustering consumption and broadcasting consumption in TDMQ for RocketMQ.

Feature Introduction

Clustering consumption: In the clustering consumption mode, each message only needs to be processed by any of the consumers in the cluster.
Broadcasting consumption: In the broadcasting consumption mode, each message is pushed to all registered consumers in the cluster to ensure that the message is consumed at least once by each consumer.

Scenarios

Clustering consumption: Suitable for scenarios where each message only needs to be processed once.
Broadcasting consumption: Suitable for scenarios where each message needs to be processed by every consumer in the cluster.

Sample Code

Clustering subscription
5.x SDK
4.x SDK
The 5.0 SDK uses the clustering consumption mode by default, requiring no special configuration.
Note:
Make sure that the subscription relationships are consistent across all consumer instances under the same group ID.
All consumers identified by the same group ID share the consumption of messages on average. For example, if a topic has 9 messages and a group ID has 3 consumer instances, in the clustering consumption mode, each instance shares the load equally and consumes only 3 of those messages.
// Set the clustering subscription mode (this is the default mode if not set).
properties.put(PropertyKeyConst.MessageModel, PropertyValueConst.CLUSTERING);
Broadcast subscription
5.x SDK
4.x SDK
The 5.0 SDK no longer supports broadcasting consumption. If you need to use the mode, you can create a separate subscription group for each consumer to achieve similar functionality.
Note:
Make sure that the subscription relationships are consistent across all consumer instances under the same group ID.

All consumers identified by the same group ID will each consume every message once. For example, if a topic has 9 messages and a group ID has 3 consumer instances, in the broadcasting consumption mode, each instance will consume all 9 messages.
// Set the broadcast subscription mode.
properties.put(PropertyKeyConst.MessageModel, PropertyValueConst.BROADCASTING);
Note
Make sure that the subscription relationships are consistent across all consumer instances under the same group ID.


Was this page helpful?
You can also Contact Sales or Submit a Ticket for help.
Yes
No

Feedback