Queries topics to which a group ID has subscribed.

Usage notes

You can call this operation to query the subscriptions between a group ID and a topic. No data is returned if all consumers under the group ID are offline.

QPS limit

The queries-per-second (QPS) limit on this operation is 10 per user. Throttling is triggered when the number of calls to this operation per second exceeds the QPS limit. Throttling may affect your business. Therefore, call this operation based on your needs. For more information, see QPS limits.

Authorization information

By default, only Alibaba Cloud accounts can call this operation. RAM users can call this operation only after they are authorized to use it. The following table lists the authorization information of this operation. For more information, see Policies and examples.

API

Action

Resource (with namespace)

Resource (without namespace)

OnsGroupSubDetail

mq:QueryGroupSubDetail

acs:mq:*:*:{instanceId}%{groupId}

acs:mq:*:*:{groupId}

Debugging

OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer. OpenAPI Explorer dynamically generates the sample code of the operation for different SDKs.

Request parameters

Parameter Type Required Example Description
Action String Yes OnsGroupSubDetail

The operation that you want to perform. Set the value to OnsGroupSubDetail.

GroupId String Yes GID_test_group_id

The group ID that you want to query.

InstanceId String Yes MQ_INST_111111111111_DOxxxxxx

The ID of the instance where the group ID you want to query is located.

Response parameters

Parameter Type Example Description
Data Struct

The returned data object.

GroupId String GID_test_group_id

The group ID that was queried.

MessageModel String CLUSTERING

The consumption mode of the group ID that has subscribed to the topic. Valid values:

  • CLUSTERING: clustering consumption
  • BROADCASTING: broadcasting consumption

For more information about consumption modes, see Clustering consumption and broadcasting consumption.

Online Boolean true

Indicates whether a consumer under the group ID is online.

SubscriptionDataList Array of SubscriptionDataList

Subscription information of consumers under the group ID. No data is returned if all consumers under the group ID are offline.

SubscriptionDataList
SubString String *

The subscription expression of the group ID that has subscribed to the topic.

Topic String test-mq_topic

The name of the topic to which the group ID has subscribed.

RequestId String 3364E875-013B-442A-BC3C-C1A84DC6****

The ID of the request, which is a common parameter. Each request has a unique ID to facilitate troubleshooting and fault locating.

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

<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

{
    "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.

Operations in the console

In addition to calling the OnsGroupSubDetail operation, you can query the subscriptions between a topic and a group ID in the Message Queue for Apache RocketMQ console. For more information, see View subscriptions.