All Products
Search
Document Center

IoT Platform:Manage consumer groups

最終更新日:Nov 30, 2023

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. This way, 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.

Features

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 and forward the messages to a specified consumer group.

    For more information about the differences between server-side subscriptions and data forwarding, see Compare data forwarding features.

  • Configure a data forwarding rule: You can use the data forwarding feature to forward messages from a specified topic to an AMQP consumer group.

Usage notes

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

Important

You can configure multiple AMQP clients for a consumer group. You cannot specify multiple consumer group IDs for an AMQP client.

Create a consumer group

  1. Log on to the IoT Platform console.

  2. On the Overview page, click All environment. On the All environment tab, find the instance that you want to manage and click the instance ID or instance name.

  3. In the left-side navigation pane, choose Server-side Subscription and click the Consumer Groups tab.

  4. Click Create Consumer Group.

  5. In the Create Consumer Group dialog box, enter a group name and click OK.

    The name of the consumer group must be 4 to 30 characters in length, and can contain letters, digits, and underscores (_). Each Chinese character or Japanese character uses two 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 the CloudMonitor console.

  1. On the Consumer Groups tab, find the consumer group that you want to manage and click View in the Actions column.

  2. On the Consumer Group Status tab, you can view the values of 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 or equal to 1, click Clear to the right of Accumulated Messages to clear the messages.

    Note

    After a consumer group is created, it may or may not accumulate messages, depending on whether it has been enabled.

    • If the consumer group has never been enabled, the consumer group is in the offline state. If you send messages to the consumer group, no messages are accumulated.

    • If the consumer group is enabled and then disabled, the consumer group is in the offline state. If you send messages to the consumer group, the messages are accumulated.

    消费组状态

  3. On the Consumer Group Status tab, click Alert Settings. In the Create Alert Rule panel, configure an alert rule to receive alert notifications and monitor the number of accumulated messages in the consumer group and the consumption rate.

    Set the Product parameter to IoT Platform-Server subscription. Configure other parameters based on your business requirements. For more information, see Configure alert rules.

  4. On the Consumer Group Details page, click Consumption Logs. On the Consumption Logs tab, you can view the details of consumption records.

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.

Warning

If a deleted consumer group is used in a subscription, the server-side subscription feature may become unavailable. As a result, your business may be interrupted. Proceed with caution.

  1. Disassociate a subscription. If a consumer group is associated with a subscription, you must disassociate the subscription from the consumer group. If the consumer group has no subscriptions, skip this step.

    1. On the Consumer Groups tab, find the consumer group and click View in the Actions column.

    2. On the Subscribed Products tab of the Consumer Group Details page, find the product that you want to manage and click Unsubscribe in the Actions column. 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 modify or delete the subscription on the Subscriptions tab of the Server-side Subscription page.

  2. On the Consumer Groups tab of the Server-side Subscription page, find the consumer group that you want to manage and click Delete in the Actions column. 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:

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.