Each consumer group serves as the identity of a message consumer. IoT Platform can forward messages to a specified consumer group. After a message consumer joins the consumer group, the message consumer can connect to IoT Platform and receive messages.
- 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. Your cloud applications can
receive messages by listening to the consumer group.
For more information about how to configure AMQP server-side subscriptions, see Configure AMQP server-side subscriptions.
- You can use the data forwarding feature to forward messages from a specified topic
to an AMQP consumer group. Your cloud applications can receive messages by listening
to the consumer group.
For more information about how to configure data forwarding rules, see Configure data forwarding rules.
For more information about the differences between server-side subscriptions and data forwarding, see Compare data forwarding solutions.
- 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. Your cloud applications can receive messages by listening to the consumer group.
- Usage: You can specify a consumer group ID for an AMQP client. The AMQP client connects
to IoT Platform as a consumer group and receives messages.
A consumer group consists of multiple AMQP clients. These clients share the ID of the consumer group. When a device message is received, IoT Platform sends the device message to a random client in the consumer group. A consumer group can have a maximum of 64 clients.
For more information, see Connect an AMQP client to IoT Platform.
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 (_).
View and monitor consumer groups
You can view the message consumption rate and the number of accumulated messages of a consumer group. To monitor consumer groups, you can also configure an alert rule in Cloud Monitor.
- On the Consumer Groups tab, find the required consumer group and click View.
- The Consumer Group Status tab shows the message consumption rate, number of accumulated messages, time of the
last consumption, and 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.
- Configure an alert rule in Cloud Monitor. You can use the alert rule to monitor the
number of accumulated messages and the message consumption. You can also use the alert
rule to receive alert notifications.
- On the Consumer Group Status tab, click Alert Settings.
- On the Create Alert Rule page, set the required parameters and click Confirm.
Section Parameter Description Related Resource Product Select IoT Platform. Resource Range Valid values:
- All Resources: all the consumer groups that are owned by each instance.
Region This parameter is available only when you set the Resource Range parameter to Instance. Select a region where the specified IoT Platform instances reside. These instances own the consumer groups to be monitored. Instance Select the required IoT Platform instances and consumer groups. You can select multiple consumer groups.
If the number of accumulated messages or the consumption rate of a consumer group reaches the specified threshold, an alert notification is sent.
Set Alert Rules Rule name Specify a name for the alert rule. Rule Description Specify the conditions that are used to trigger alerts. Set the following items:
- A metric to be monitored.
- A scan period. For example, if the scan period is set to 60 minutes, scans are performed every 60 minutes.
- An alert condition. For example, if the value of a specified metric is greater than 1,000 for three consecutive scan periods, an alert is triggered.
Mute for Set a retry interval. If an alert persists, the system sends another alert notification after the specified retry interval. Effective Period Set the validity period of the alert rule. The alert rule sends alert notifications only within the specified validity period. Notification Method Notification Contact Set the required contact groups that are used to receive alert notifications. For more information, see Configure alert contacts. Notification Methods
- Email + DingTalk (Info)
Auto Scaling Specifies whether to use Auto Scaling. After this field is selected, the related scaling rule is triggered when an alert occurs. Log Service Specifies whether to use Log Service. After this field is selected, the information of alerts is written to Log Service. Email Subject This parameter is available only when you set Resource Range to Instance. Enter the subject of an email that is sent to the specified alert contacts when an alert occurs. By default, an email subject includes a product name, metric name, and instance ID. Email Remark Enter the remarks of an email that is sent to the specified alert contacts when an alert occurs. HTTP Callback Enter a URL that is accessible over the Internet. Cloud Monitor pushes alert notifications to this URL by using HTTP POST requests.
Delete a consumer group
You can delete a consumer group. However, you cannot delete the default consumer group. After you delete a consumer group, all consumer clients in the consumer group will 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 the consumer group
has no subscriptions, you can skip this step.
- On the Consumer Groups tab, click View next to the consumer group.
- On the Subscribed Products tab of the Consumer Group Details page, find the required product and click Unsubscribe next to the product. In the dialog box that appears, accept the agreement and click
Confirm.Note If only one consumer group is associated with the server-side subscription of the product, the unsubscribe action is unavailable on the Consumer Group Details page. In this case, go to the Server-side Subscription page, edit the subscription, and change the consumer group or delete the subscription.
- On the Consumer Groups tab of the Server-side Subscription page, find the required consumer group and click Delete. In the dialog box that appears, accept the agreement and click Confirm.
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: