Reviewed-by: Ziuzko, Stanislav <stanislav.ziuzko@t-systems.com> Co-authored-by: chenjunjie <chenjunjie@huawei.com> Co-committed-by: chenjunjie <chenjunjie@huawei.com>
17 KiB
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
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
project_id |
Yes |
String |
Definition Project ID. For details about how to obtain it, see Obtaining a Project ID. Constraints N/A Range N/A Default Value N/A |
instance_id |
Yes |
String |
Definition Instance ID. You can call the API for querying all instances to obtain the instance ID. The instance ID is in the response body. Constraints N/A Range N/A Default Value N/A |
group |
Yes |
String |
Definition Consumer group name. Constraints N/A Range N/A Default value N/A |
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
topic |
No |
String |
Definition 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. Constraints N/A Range N/A Default value N/A |
limit |
No |
Integer |
Definition Maximum number of topics that can be returned in a query. Constraints N/A Range 1–50 Default value 10 |
offset |
No |
Integer |
Definition Offset where the query starts. Constraints N/A Range ≥ 0 Default value 0 |
Request Parameters
None
Response Parameters
Status code: 200
Parameter |
Type |
Description |
|---|---|---|
topics |
Array of strings |
Definition Topic list. This parameter is displayed only when you query the topic consumption list. Constraints N/A Range N/A Default Value N/A |
total |
Integer |
Definition Total number of topics. This parameter is displayed only when you query the topic consumption list. Constraints N/A Range N/A Default Value N/A |
lag |
Long |
Definition Total number of accumulated messages. Constraints N/A Range N/A Default Value N/A |
max_offset |
Long |
Definition Total number of messages. Constraints N/A Range N/A Default Value N/A |
consumer_offset |
Long |
Definition Number of consumed messages. Constraints N/A Range N/A Default Value N/A |
brokers |
Array of Brokers objects |
Definition Associated brokers of topics. This parameter is displayed only when you query the topic consumption details. Constraints N/A Range N/A Default Value N/A |
Parameter |
Type |
Description |
|---|---|---|
broker_name |
String |
Definition Names of the associated brokers. Constraints N/A Range N/A Default Value N/A |
queues |
Array of Queue objects |
Definition Queue details of the associated brokers. Constraints N/A Range N/A Default Value N/A |
Parameter |
Type |
Description |
|---|---|---|
id |
Integer |
Definition Queue ID. Constraints N/A Range N/A Default Value N/A |
lag |
Long |
Definition Total number of accumulated messages in the queue. Constraints N/A Range N/A Default Value N/A |
broker_offset |
Long |
Definition Total number of messages in the queue. Constraints N/A Range N/A Default Value N/A |
consumer_offset |
Long |
Definition Number of consumed messages. Constraints N/A Range N/A Default Value N/A |
last_message_time |
Long |
Definition Time (UNIX, in millisecond) when the latest consumed message was stored. Constraints N/A Range N/A Default Value N/A |
Example Requests
Topic list of the consumer group queried
GET https://{endpoint}/v2/{project_id}/instances/{instance_id}/groups/{group}/topicsConsumer group details queried
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.
Querying the topic list of a consumer group
{ "topics" : [ "topic-test" ], "total" : 1 }Query consumer group details
{ "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.