A group contains producers or consumers that produce or consume messages of the same type based on the same logic. To use ApsaraMQ for RocketMQ to produce or consume messages, you must create groups to identify producer instances or consumer instances of the same type. This topic describes how to create and delete a group in the ApsaraMQ for RocketMQ console. This topic also describes how to view the details of a group.
Limits
Up to 1,000 groups can be created on an ApsaraMQ for RocketMQ instance. We recommend that you reuse groups or delete groups that are no longer required at the earliest opportunity. If you want to increase the upper limit on groups, contact ApsaraMQ for RocketMQ technical support.
A group cannot be used across instances. For example, a group that is created on Instance A cannot be used on Instance B.
In ApsaraMQ for RocketMQ, consumers can consume messages over the HTTP or TCP protocol. Different consumer groups can use different protocols. We recommend that you specify the same protocol for all consumers in a group.
If consumers in the same group consume messages over different protocols, message consumption may fail and message duplication or message loss may occur.
Approximately 1 to 2 hours is required to change the protocol over which consumers in a group consume messages.
If consumers in a group consume messages over a protocol that is different from the protocol displayed in the ApsaraMQ for RocketMQ console, the data displayed in the console can be inaccurate. This does not affect the messaging of the group. In this case, you can contact ApsaraMQ for RocketMQ technical support to change the protocol displayed in the console to the protocol that is used by consumers in the group.
A group ID must be specified for each consumer. You do not need to specify a group ID for each producer.
Naming conventions for group IDs
A group ID must be 2 to 64 characters in length and can contain letters, digits, hyphens (-), and underscores (_). We recommend that you include the prefix GID_ or GID- in a group ID.
If the instance to which a group belongs has a namespace, the ID of the group must be unique in the instance. The group ID cannot be the same as an existing group ID or topic name in the instance. Group IDs and topic names in different instances can be the same. For example, a group ID in Instance A can be the same as a group ID or a topic name in Instance B.
If the instance to which a group belongs does not contain a namespace, the group ID must be globally unique across instances and regions. The group ID cannot be the same as an existing group ID or topic name in ApsaraMQ for RocketMQ in your Alibaba Cloud account.
You can check whether an instance contains a namespace in the Basic Information section of the Instance Details page in the ApsaraMQ for RocketMQ console.
Create a consumer group
Log on to the ApsaraMQ for RocketMQ console. In the left-side navigation pane, click Instances.
In the top navigation bar, select a region, such as China (Hangzhou). On the Instances page, click the name of the instance that you want to manage.
In the left-side navigation pane, click Groups.
On the Groups page, select a protocol for your client SDK and click Create Group.
ApsaraMQ for RocketMQ supports TCP and HTTP for client SDKs.
In the panel that appears, configure the Group ID and Description parameters and click OK.
Delete a group
After you delete a group, consumer instances identified by the ID of the group stop receiving messages. Resources in the group are also deleted and cannot be restored. Exercise caution when you delete a group.
On the Instances page, click the name of the instance that you want to manage. In the left-side navigation pane of the page that appears, click Groups.
In the group list, find the group that you want to manage, click More in the Actions column, and then select Delete from the drop-down list.
In the message that appears, click OK.
View the details of a group
On the Instances page, click the name of the instance that you want to manage. In the left-side navigation pane of the page that appears, click Groups.
In the group list, find the group that you want to manage. Then, click the ID of the group or Details in the Actions column corresponding to the group to go to the Group Details page.
More operations
On the Groups page, you can also perform the following operations:
In the left-side navigation pane, click Groups.
In the group list, find the group that you want to manage, click More in the Actions column, and then select one of the following operations from the drop-down list:
Quick Access: View references that ApsaraMQ for RocketMQ provides for SDKs for multiple programming languages.
Reset Consumer Offset: Reset the consumer offset to skip accumulated or undesired messages and start message consumption from a new offset. You can also consume messages after a specific point in time, regardless of whether messages before this point in time are consumed. For more information, see Reset consumer offsets.
Cloud Monitor: View the monitoring data of message production or consumption in the group.
Dashboard: View the consumption metric statistics of the group.
References
You can call the following API operations to manage groups:
OnsGroupCreate: creates a group.
OnsGroupDelete: deletes a group.
OnsGroupList: queries all groups on an ApsaraMQ for RocketMQ instance.
OnsGroupSubDetail: queries the topics to which a group subscribes.
OnsGroupConsumerUpdate: configures the read and write permissions for a group.