Updated on 2025-03-26 GMT+08:00

Querying a Consumer Group

Function

This API is used to query a specified consumer group.

URI

GET /v2/{project_id}/mqs/instances/{instance_id}/management/groups/{group}

Table 1 Path Parameters

Parameter

Mandatory

Type

Description

project_id

Yes

String

Project ID

instance_id

Yes

String

Instance ID

group

Yes

String

Consumer group ID

Request Parameters

None

Response Parameters

Status code: 200

Table 2 Response body parameters

Parameter

Type

Description

[items]

Array of ShowGroupResp objects

-

Table 3 ShowGroupResp

Parameter

Type

Description

group

Array of ShowGroupEntity objects

Consumer group information

Table 4 ShowGroupEntity

Parameter

Type

Description

group_id

String

Consumer group name

state

String

Consumer group status. The value can be:

Dead: The consumer group has no members and no metadata.

Empty: The consumer group has metadata but has no members.

PreparingRebalance: The consumer group is to be rebalanced.

CompletingRebalance: All members have joined the group.

Stable: Members in the consumer group can consume messages normally.

coordinator_id

Integer

Coordinator ID

members

Array of MemberEntity objects

Consumer list

group_message_offsets

Array of GroupMessageOffsetsEntity objects

Consumer offset

assignment_strategy

String

Partition assignment policy

Table 5 MemberEntity

Parameter

Type

Description

host

String

Consumer address.

assignment

Array of AssignmentEntity objects

Details about the partition assigned to the consumer.

member_id

String

Consumer ID

client_id

String

Client ID

Table 6 AssignmentEntity

Parameter

Type

Description

topic

String

Topic name.

partitions

Array of integers

Partition list

Table 7 GroupMessageOffsetsEntity

Parameter

Type

Description

partition

Integer

Partition ID

lag

Integer

Number of remaining messages that can be consumed, that is, the number of accumulated messages.

topic

String

Topic name.

message_current_offset

Integer

Consumer offset

message_log_end_offset

Integer

Log end offset (LEO)

Example Requests

None

Example Responses

Status code: 200

The consumer group details are queried successfully.

{
  "group" : {
    "members" : [ {
      "host" : "/172.31.1.102",
      "assignment" : [ {
        "topic" : "test",
        "partitions" : [ 0, 1, 2 ]
      } ],
      "member_id" : "consumer-1-6b8ee551-d499-47d4-9beb-ba1527496785",
      "client_id" : "consumer-1"
    } ],
    "state" : "STABLE",
    "group_id" : "test-consumer-group",
    "coordinator_id" : 2,
    "group_message_offsets" : [ {
      "partition" : 0,
      "lag" : 31396,
      "topic" : "test",
      "message_current_offset" : 935,
      "message_log_end_offset" : 32331
    }, {
      "partition" : 0,
      "lag" : 0,
      "topic" : "aaaa",
      "message_current_offset" : 0,
      "message_log_end_offset" : 0
    }, {
      "partition" : 1,
      "lag" : 31279,
      "topic" : "test",
      "message_current_offset" : 1058,
      "message_log_end_offset" : 32337
    }, {
      "partition" : 1,
      "lag" : 0,
      "topic" : "aaaa",
      "message_current_offset" : 0,
      "message_log_end_offset" : 0
    }, {
      "partition" : 2,
      "lag" : 31603,
      "topic" : "test",
      "message_current_offset" : 739,
      "message_log_end_offset" : 32342
    } ],
    "assignment_strategy" : "range"
  }
}

Status Codes

Status Code

Description

200

The consumer group details are queried successfully.

Error Codes

See Error Codes.