A consumer group is used to identify a message consumer. To connect a message consumer to IoT Platform, add the message consumer to a consumer group. Then, the message consumer can receive the messages that are forwarded by IoT Platform to the consumer group. This topic describes how to create, view, and delete a consumer group in the IoT Platform console.
Background information
- Usage notes:
You can use one of the following methods to listen to consumer groups and obtain forwarded messages:
- Configure an AMQP server-side subscription: You can use an Advanced Message Queuing Protocol (AMQP) server-side subscription to subscribe to a specified type of messages that are sent by all 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 subscription and data forwarding, see Compare data forwarding features.
- Considerations:
You can specify a consumer group ID for an AMQP client. This way, 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 contain up to 64 AMQP clients. The 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
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 the CloudMonitor console.
Delete a consumer group
You can delete a consumer group, but you cannot delete the default consumer group. After a consumer group is deleted, all clients in the group can no longer receive messages.
- Disassociate a subscription. If a consumer group is associated with a subscription,
you must disassociate the subscription from the consumer group. If no subscriptions
are configured for the consumer group, skip this step.
- 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.
References
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
- Connect a client to IoT Platform by using the SDK for PHP
- Connect a client to IoT Platform by using the SDK for Go
Related API operations
API | Description |
---|---|
CreateConsumerGroup | Creates a consumer group that is used to create 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 consumer groups of an Alibaba Cloud 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 most recent 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. |