Each consumer group serves as the identity of a message consumer. The message consumer connects to IoT Platform by joining a consumer group and receives messages that are forwarded by IoT Platform to the consumer group. This article describes how to manage and view consumer groups in IoT Platform.
- Feature description:
You can use the following methods to listen to consumer groups and obtain forwarded messages:
- Configure an AMQP server-side subscription: You can use an AMQP server-side subscription to subscribe to a specified type of messages that are sent by all the devices of a product. This subscription also allows you to forward these messages to a specified consumer group.
- Configure a data forwarding rule: You can use the data forwarding feature to forward messages from a specified topic to an AMQP consumer group.
For more information about the differences between server-side subscriptions and data forwarding, see Compare data forwarding solutions.
- Usage notes
You can specify a consumer group ID for an AMQP client. Then, the AMQP client can connect to IoT Platform and receive messages. For more information, see Connect an AMQP client to IoT Platform.
A consumer group can consist of up to 64 AMQP clients. These clients share the ID of the consumer group. After a device message is sent to IoT Platform, IoT Platform forwards the message to a random client in the consumer group.
Create a consumer group
- Log on to the IoT Platform console.
- In the left-side navigation pane, choose Consumer Groups tab. and click the
- Click Create Consumer Group.
- In the Create Consumer Group dialog box, enter a group name and click OK. The consumer group name must be 4 to 30 characters in length, and can contain letters, digits, and underscores (_). Each Chinese character or Japanese character uses 2 characters.
View and monitor consumer groups
You can view the message consumption rate and the number of accumulated messages of a consumer group. To monitor the consumer group, you can configure an alert rule in CloudMonitor.
- On the Consumer Groups tab, find the required consumer group and click View.
- On the Consumer Group Status tab, you can view the Real-time Message Consumption Rate, Accumulated Message Consumption Rate, Accumulated Messages, and Last Consumed At parameters. You can also view online clients. If the number of accumulated messages is greater than 0, click Clear that appears on the right side of Accumulated Messages to clear these messages.
- On the Consumer Group Status tab, click Alert Settings. On the Create Alert Rule page, configure an alert rule to monitor the number of accumulated messages in the
consumer group and the consumption rate, and receive alert notifications. Set Product to IoT Platform-Server subscription. Set other parameters based on your requirements. For more information, see Create a threshold-triggered alert rule.
Delete a consumer group
You can delete a consumer group. However, you cannot delete the default consumer group. After a consumer group is deleted, all clients in the group stop receiving messages.
- Disassociate a subscription. If a consumer group is associated with a subscription,
you must disassociate the subscription with the consumer group. If the consumer group
has no subscriptions, skip this step.
- On the Consumer Groups tab, find the consumer group and click View.
- On the Subscribed Products tab of the Consumer Group Details page, find the product and click Unsubscribe. In the message that appears, click OK. Note If only one consumer group is associated with a server-side subscription, the unsubscribe action is unavailable on the Consumer Group Details page. You must edit or delete the subscription on the Subscriptions tab of the Server-side Subscription page.
- On the Consumer Groups tab of the Server-side Subscription page, find the consumer group and click Delete. In the message that appears, click OK.
For more information about how to specify a consumer group ID for an AMQP client and use the AMQP client to receive messages, see the following topics:
- Connect an AMQP client to IoT Platform
- Connect a client to IoT Platform by using the SDK for Java
- Connect a client to IoT Platform by using the SDK for Node.js
- Connect a client to IoT Platform by using the SDK for .NET
- Connect a client to IoT Platform by using the SDK for Python 2.7
- Connect a client to IoT Platform by using the SDK for Python 3
- PHP SDK access example
- Connect a client to IoT Platform by using the SDK for Go
|CreateConsumerGroup||Creates a consumer group that is required for an AMQP server-side subscription.|
|UpdateConsumerGroup||Modifies the name of a consumer group.|
|QueryConsumerGroupByGroupId||Queries the details of a consumer group by consumer group ID.|
|QueryConsumerGroupList||Queries all the consumer groups of an account, or performs a fuzzy search by consumer group name.|
|QueryConsumerGroupStatus||Queries the status of a consumer group when an AMQP server-side subscription is enabled. The status information includes the online client information, message consumption rate, number of accumulated messages, and latest message consumption time.|
|ResetConsumerGroupPosition||Clears the accumulated messages of a consumer group when an AMQP server-side subscription is enabled.|
|DeleteConsumerGroup||Deletes a consumer group.|