Queries the topics to which consumers in a group subscribe.
Note
You can call this operation to query the information about the topics to which consumers in a group subscribe. If all consumers in the specified group are offline, no topics are returned.
Request limit
Each Alibaba Cloud account can call this operation up to 10 times per second. If the number of requests that you send to call this operation within one second reaches the request limit, new requests fail. This may interrupt your business. For information about the request limit of each operation, see API request limits.
Authorization
By default, Alibaba Cloud accounts can call this operation. A Resource Access Management (RAM) user can call this operation only after the RAM user is granted the required permissions. The following table describes the permissions that must be granted to a RAM user to call this operation. For information about how to grant permissions, see Policies.
API |
Action |
Resource in an instance that uses a namespace |
Resource in an instance that does not use a namespace |
---|---|---|---|
OnsGroupSubDetail |
mq:QueryInstanceBaseInfo mq:QueryGroupSubDetail |
acs:mq:*:*:{instanceId}%{groupId} |
acs:mq:*:*:{groupId} |
Request parameters
Parameter | Type | Required | Example | Description |
---|---|---|---|---|
Action | String | Yes | OnsGroupSubDetail |
The operation that you want to perform. Set the value to OnsGroupSubDetail. |
InstanceId | String | Yes | MQ_INST_111111111111_DOxxxxxx |
The ID of the Message Queue for Apache RocketMQ instance which contains the consumer group you want to query. |
GroupId | String | Yes | GID_test_group_id |
The ID of the consumer group that you want to query. |
Response parameters
Parameter | Type | Example | Description |
---|---|---|---|
RequestId | String | 3364E875-013B-442A-BC3C-C1A84DC6**** |
The ID of the request. The system generates a unique ID for each request. You can troubleshoot issues based on the request ID. |
Data | Object |
The data that is returned. |
|
SubscriptionDataList | Array of SubscriptionDataList |
The topics to which consumers in the consumer group subscribe. If all consumers in the specified group are offline, no topics are returned. |
|
SubscriptionDataList | |||
SubString | String | * |
The expression based on which consumers in the consumer group subscribe to the topic. |
Topic | String | test-mq_topic |
The name of the topic to which consumers in the consumer group subscribe. |
GroupId | String | GID_test_group_id |
The ID of the consumer group. |
MessageModel | String | CLUSTERING |
The consumption mode. Valid values:
For more information about consumption modes, see Clustering consumption and broadcasting consumption. |
Online | Boolean | true |
Indicates whether consumers in the group are online. |
Examples
Sample requests
http(s)://ons.cn-hangzhou.aliyuncs.com/?Action=OnsGroupSubDetail
&GroupId=GID_test_group_id
&InstanceId=MQ_INST_111111111111_DOxxxxxx
&<Common request parameters>
Sample success responses
XML
format
HTTP/1.1 200 OK
Content-Type:application/xml
<OnsGroupSubDetailResponse>
<Data>
<MessageModel>CLUSTERING</MessageModel>
<Online>true</Online>
<SubscriptionDataList>
<SubscriptionDataList>
<SubString>*</SubString>
<Topic>test-mq_topic</Topic>
</SubscriptionDataList>
</SubscriptionDataList>
<GroupId>GID_test_group_id</GroupId>
</Data>
<RequestId>3364E875-013B-442A-BC3C-C1A84DC6****</RequestId>
</OnsGroupSubDetailResponse>
JSON
format
HTTP/1.1 200 OK
Content-Type:application/json
{
"Data" : {
"MessageModel" : "CLUSTERING",
"Online" : true,
"SubscriptionDataList" : {
"SubscriptionDataList" : [ {
"SubString" : "*",
"Topic" : "test-mq_topic"
} ]
},
"GroupId" : "GID_test_group_id"
},
"RequestId" : "3364E875-013B-442A-BC3C-C1A84DC6****"
}
Error codes
For a list of error codes, visit the API Error Center.
View the topics to which a consumer group subscribes in the console
In the Message Queue for Apache RocketMQ console, you can view the topics to which consumers in a group subscribe. For more information, see View subscriptions.