A group represents a collection of nodes (devices) that share the same business logic and features. Before your clients can send or receive messages, you must create a group and assign it a unique group ID.
Group ID naming rules
A group ID must meet the following requirements:
| Requirement | Detail | Example |
|---|---|---|
| Prefix | Must start with GID_ or GID- | GID_sensors |
| Length | 7 to 64 characters | GID_temp_01 (11 characters) |
| Characters | Letters, digits, hyphens (-), and underscores (_) only | GID_my-device_01 |
Group IDs must be unique within an instance but can be reused across different instances.
Examples:
| Group ID | Valid | Reason |
|---|---|---|
GID_sensors_01 | Yes | Correct prefix, valid characters |
GID-temperature | Yes | GID- prefix is also valid |
sensors_01 | No | Missing required GID_ or GID- prefix |
GID_a | No | Too short (5 characters, minimum is 7) |
Prerequisites
Before you begin, make sure that you have:
An ApsaraMQ for MQTT instance
Access to the ApsaraMQ for MQTT console
Create a group
Log on to the ApsaraMQ for MQTT console. In the left-side navigation pane, click Instances.
In the top navigation bar, select the region where your instance resides. Click the instance name to go to the Instance Details page.
In the left-side navigation pane, click Groups.
In the upper-left corner of the Groups page, click Create Group.
In the Create Group panel, enter a Group ID and click OK.
Delete a group
Deleting a group is permanent. After deletion, disconnected producer and consumer clients identified by the group ID fail authentication when they attempt to reconnect. Connected clients are not affected until they disconnect. Before deleting a group, verify that no active clients depend on it.
Go to the Groups page.
Find the target group. In the Actions column, choose More > Delete.
In the dialog box, click OK.
View group details
Go to the Groups page.
Find the target instance in the instance list. In the Actions column, choose More > Groups.
Find the target group and click its group ID to open the Group Details page.
What's next
After you create a topic and a group, start sending and receiving messages. For more information, see Use ApsaraMQ for MQTT SDK for Java to implement messaging between ApsaraMQ for MQTT clients and backend service applications.