nav-img
Advanced

Creating a Consumer Group or Batch Deleting Consumer Groups

Function

This API is used to create a consumer group or batch deleting consumer groups.

URI

POST /v2/{project_id}/instances/{instance_id}/groups

Table 1 Path Parameters

Parameter

Mandatory

Type

Description

project_id

Yes

String

Project ID. For details, see Obtaining a Project ID.

instance_id

Yes

String

Instance ID.

Table 2 Query Parameters

Parameter

Mandatory

Type

Description

action

No

String

This parameter is used to delete consumer groups in batches. If it is not set, a consumer group will be created. delete: Delete consumer groups in batches.

Request Parameters

Table 3 Request body parameters

Parameter

Mandatory

Type

Description

groups

No

Array of strings

List of consumer groups to be deleted.

name

No

String

Consumer group name. Enter 3 to 64 characters. Use only letters, digits, percent (%), vertical bars (|), hyphens (-), and underscores (_).

brokers

No

Array of strings

Associated brokers. This parameter is mandatory only for RocketMQ 4.8.0 instances.

broadcast

No

Boolean

Whether to broadcast.

retry_max_time

No

Integer

Maximum number of retries (1 to 16 characters).

enabled

No

Boolean

Whether consumption is allowed.

consume_orderly

No

Boolean

Indicates whether to enable ordered consumption (This parameter is mandatory only for RocketMQ 5.x instances).

group_desc

No

String

Consumer group description (0 to 200 characters).

Response Parameters

Status code: 200

Table 4 Response body parameters

Parameter

Type

Description

job_id

String

ID of the job for deleting consumer groups.

name

String

ID of the consumer group that is successfully created.

Example Requests

  • For RocketMQ 4.8.0 instances: Creating a consumer group with broadcast consumption disabled, associated with broker-0, and max. 16 retries.

    POST https://{endpoint}/v2/{project_id}/instances/{instance_id}/groups
    {
    "name" : "consumer-group-test",
    "group_desc" : "group_description",
    "brokers" : [ "broker-0" ],
    "broadcast" : false,
    "retry_max_time" : 16
    }
  • Deleting consumer group consumer-group-test.

    POST https://{endpoint}/v2/{project_id}/instances/{instance_id}/groups?action=delete
    {
    "groups" : [ "consumer-group-test" ]
    }

Example Responses

Status code: 200

A consumer group is created or multiple consumer groups are deleted in batches.

{
"name" : "consumer-group-test"
}

Status Codes

Status Code

Description

200

A consumer group is created or multiple consumer groups are deleted in batches.

Error Codes