When migrating Kafka workloads to the cloud or iterating in development, creating consumer Groups manually in the console slows you down. The Flexible Group Creation feature eliminates this step -- Groups are created automatically when a consumer connects with a group.id that does not yet exist.
| Approach | When to use |
|---|---|
| Enable automatic Group creation (this guide) | Cloud migration, development, or testing. No console steps needed. |
| Create Groups manually | Production. Full control over resource allocation and naming. See Create a Group or the CreateConsumerGroup API. |
Do not leave automatic Group creation enabled long-term in production. Misconfigured clients can cause uncontrolled resource consumption, increasing O&M costs and risking system instability.
Prerequisites
Before you begin, make sure that your ApsaraMQ for Kafka instance meets the following requirements:
| Requirement | Value |
|---|---|
| Status | Running |
| Major version | 2.2.0 |
| Minor version | Latest |
Check the instance status and version in the Basic Information section on the Instance Details page.
Enable the feature
Log on to the ApsaraMQ for Kafka console.
In the Resource Distribution section of the Overview page, select the region where your instance is deployed.
On the Instances page, click the name of the instance.
In the Configuration Information section, turn on the Flexible Group Creation switch.
Consume messages with an auto-created Group
Set group.id to a name that does not yet exist. The Group is created automatically on the first poll.
props.put(ConsumerConfig.GROUP_ID_CONFIG, "newConsumerGroup");
consumer.subscribe(Collections.singletonList("newTopicName"));
// If the Group does not exist and its name is valid, it is automatically created.
consumer.poll(Duration.ofSeconds(1));This works with any consumer SDK that supports the standard group.id property.
Disable the feature
Review the following before turning off automatic Group creation:
| Consideration | Details |
|---|---|
| Existing consumers are affected | Groups not created through the console can no longer consume messages or commit offsets after the feature is disabled. Disable with caution. |
| Disabling is asynchronous | The instance status changes to Upgrading during the process and returns to In Service after completion. Nodes are not restarted. |
| Do not create Groups during the transition | Avoid creating new Groups automatically while the feature is being disabled. |
To disable the feature, return to the Configuration Information section on the Instance Details page and turn off the Flexible Group Creation switch.
Group naming rules
Auto-created Group names must follow these rules:
| Rule | Value |
|---|---|
| Length | 3 to 128 characters |
| Allowed characters | Letters, digits, hyphens (-), and underscores (_) |
| Additional requirement | At least one letter or digit |
Limits
The number of automatically created Groups cannot exceed your instance specification limit. After the limit is reached, no new Groups can be created automatically. For details, see Limits.
The server cleans up auto-created Groups after their consumer offsets expire.
Identify auto-created Groups in the console
Auto-created Groups are listed on the Groups page with the description "Automatically created."
The Auto Creation column for these Groups is set to Yes.
Assign-mode offset commits
Even without the Flexible Group Creation feature enabled, committing consumer offsets using the Assign method creates a corresponding Group on the Kafka cluster. This behavior is enabled by default. To disable it, submit a ticket.