Updated on 2023-09-04 GMT+08:00

Viewing All Consumer Groups of a Specified Queue

Function

This API is used to view all consumer groups of a specified queue.

URI

GET /v1.0/{project_id}/queues/{queue_id}/groups?include_deadletter={include_deadletter}&include_messages_num={boolean}&page_size={page_size}&current_page={current_page}

Table 1 describes the parameters of this API.

Table 1 Parameters

Parameter

Type

Mandatory

Description

project_id

String

Yes

Indicates the project ID.

queue_id

String

Yes

Indicates the queue ID.

include_deadletter

Boolean

No

Indicates whether to list dead letter parameters in the response message. The default value is false.

include_messages_num

Boolean

No

Indicates whether to query the details of consumer groups.

Default value: true.

If this parameter is set to false, consumption details of a consumer group are not queried, and the API responses in a short time.

page_size

Integer

No

Indicates the number of consumer groups displayed on each page.

If page_size and current_page are not set to a valid value at the same time, consumer groups displayed on all pages are queried by default.

current_page

Integer

No

Indicates the number of a page on which consumer groups are to be queried.

If page_size and current_page are not set to a valid value at the same time, consumer groups displayed on all pages are queried by default.

Example
GET v1.0/b78a90ae2a134b4b8b2ba30acab4e23a/queues/075ae7da-6ce5-4966-940c-17c19fb5175e/groups?include_deadletter=true

Request

Request parameters

None.

Example request

None.

Response

Response parameters

Table 2 and Table 3 describe the response parameters.

Table 2 Response parameters

Parameter

Type

Description

queue_id

String

Indicates the queue ID.

queue_name

String

Indicates the queue name.

groups

Array

Indicates the consumer group list.

redrive_policy

String

Indicates whether to enable dead letter messages. This parameter is displayed only when include_deadletter is set to true.

Options:

  • enable
  • disable
Table 3 groups parameter description

Parameter

Type

Description

id

String

Indicates the consumer group ID.

name

String

Indicates the name of a consumer group.

produced_messages

Integer

Indicates the total number of messages (not including the messages that have expired and been deleted) in a queue.

consumed_messages

Integer

Indicates the total number of messages that are successfully consumed.

available_messages

Integer

Indicates the accumulated number of normal messages available to the consumer group.

produced_deadletters

Integer

Indicates the total number of dead letter messages generated by the consumer group. This parameter is displayed only when include_deadletter is set to true.

available_deadletters

Integer

Indicates the accumulated number of dead letter messages not consumed in the consumer group. This parameter is displayed only when include_deadletter is set to true.

Example response

{
    "queue_name" : "queue-772289871",
    "groups" : [{
            "name" : "group-1690260950",
            "id" : "g-eb9305bb-5bec-4712-84ab-0a36fbe9c2c0",
            "consumed_messages" : 0,
            "available_messages" : 8,
            "produced_messages" : 10,
        }
    ],
    "redrive_policy" : "enable",
    "queue_id" : "f5b6dd28-08dd-4f0f-866c-2eadf6788163"
}
When include_messages_num is set to false:
{
    "queue_name" : "queue-586845368",
    "groups" : [{
            "name" : "group-364417183",
            "id" : "g-33d53064-2ab9-4acc-8566-3faa8c8578bf",
            "consumed_messages" : 0,
            "available_messages" : 0,
            "produced_messages" : 0,
        }, {
            "name" : "group-1722391629",
            "id" : "g-876fc3a2-e8c1-4a81-af3e-9ef68e3e46cf",
            "consumed_messages" : 0,
            "available_messages" : 0,
            "produced_messages" : 0,
        }
    ],
    "queue_id" : "e7e6d7f6-c555-470a-b9ee-3175e3408250"
}

Status Code

Table 4 lists the status code indicating that the operation is successful. For details about the status codes indicating that the operation fails, see Status Code.

Table 4 Status code

Status Code

Description

200

The information is obtained successfully.