Updated on 2024-04-08 GMT+08:00

Querying the Consumer Group List or Details

Function

This API is used to query the consumer group list or details.

URI

GET /v2/{project_id}/instances/{instance_id}/groups/{group}/topics

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.

group

Yes

String

Consumer group name.

Table 2 Query Parameters

Parameter

Mandatory

Type

Description

topic

No

String

Topic to be queried. If this parameter is not specified, the entire topic list is queried. If this parameter is specified, details of the topic are queried.

limit

No

Integer

Maximum number of records returned in the current query. The default value is 10. The value ranges from 1 to 50.

Minimum: 1

Maximum: 50

Default: 10

offset

No

Integer

Offset, which is the position where the query starts. The value must be greater than or equal to 0.

Minimum: 0

Default: 0

Request Parameters

None

Response Parameters

Status code: 200

Table 3 Response body parameters

Parameter

Type

Description

topics

Array of strings

Topic list. This parameter is displayed only when you query the topic consumption list.

total

Integer

Total number of topics. This parameter is displayed only when you query the topic consumption list.

lag

Long

Total number of accumulated messages.

max_offset

Long

Total number of messages.

consumer_offset

Long

Consumed messages.

brokers

Array of Brokers objects

Associated brokers of topics. This parameter is displayed only when you query the topic consumption list.

Table 4 Brokers

Parameter

Type

Description

broker_name

String

Names of the associated brokers.

queues

Array of Queue objects

Queue details of the associated brokers.

Table 5 Queue

Parameter

Type

Description

id

Integer

Queue ID.

lag

Long

Total number of accumulated messages in the queue.

broker_offset

Long

Total number of messages in the queue.

consumer_offset

Long

Number of retrieved messages.

last_message_time

Long

Time (UNIX, in millisecond) when the latest consumed message was stored.

Example Requests

GET https://{endpoint}/v2/{project_id}/instances/{instance_id}/groups/{group}/topics?topic=test0001

Example Responses

Status code: 200

Consumer group list or details queried successfully.

  • Consumer group topics are queried successfully.

    {
      "topics" : [ "topic-test" ],
      "total" : 1
    }
  • Consumer group details are queried successfully.

    {
      "lag" : 0,
      "max_offset" : 1,
      "consumer_offset" : 1,
      "brokers" : [ {
        "broker_name" : "broker-0",
        "queues" : [ {
          "id" : 0,
          "lag" : 0,
          "broker_offset" : 0,
          "consumer_offset" : 0,
          "last_message_time" : 0
        }, {
          "id" : 1,
          "lag" : 0,
          "broker_offset" : 1,
          "consumer_offset" : 1,
          "last_message_time" : 1679398537088
        }, {
          "id" : 0,
          "lag" : 0,
          "broker_offset" : 0,
          "consumer_offset" : 0,
          "last_message_time" : 0
        } ]
      } ]
    }

Status Codes

Status Code

Description

200

Consumer group list or details queried successfully.

Error Codes

See Error Codes.