Queries the connection information of consumers of a specified group ID.

Usage notes

When an error occurs in message consumption, you can call this operation to query the connection status of consumers of the specified group ID and identify possible causes.

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 a namespace

Resource without a namespace

OnsConsumerGetConnection

mq:QueryConsumerConnection

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

acs:mq:*:*:{groupId}

Request parameters

Parameter Type Required Example Description
Action String Yes OnsConsumerGetConnection

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

GroupId String Yes GID_test_consumer_id

The group ID of the consumers whose connection status you want to query.

InstanceId String Yes MQ_INST_111111111111_DOxxxxxx

The ID of the instance where the group ID is located.

Response parameters

Parameter Type Example Description
Data Struct

The data structure of returned parameters.

ConnectionList Array of ConnectionDo

The connection information of the specified group ID.

ConnectionDo
ClientAddr String 30.5.121.**

The address and port number of the consumer instance.

ClientId String 30.5.121.**@24813#-1999745829#-1737591554#453111174894656

The ID of the consumer instance.

Language String JAVA

The programming language in which the consumer application was developed.

Version String V4_3_6

The version of the consumer.

RequestId String DE4140C7-F42D-473D-A5FF-B1E31692****

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=OnsConsumerGetConnection
&GroupId=GID_test_consumer_id
&InstanceId=MQ_INST_111111111111_DOxxxxxx
&<Common request parameters>

Sample success responses

XML format

<OnsConsumerGetConnectionResponse>
      <Data>
            <ConnectionList>
                  <ConnectionDo>
                        <ClientAddr>30.5.121. **</ClientAddr>
                        <Language>JAVA</Language>
                        <Version>V4_3_6</Version>
                        <ClientId>30.5.121. **@24813#-1999745829#-1737591554#453111174894656</ClientId>
                  </ConnectionDo>
            </ConnectionList>
      </Data>
      <RequestId>DE4140C7-F42D-473D-A5FF-B1E31692****</RequestId>
</OnsConsumerGetConnectionResponse>

JSON format

{
    "Data": {
        "ConnectionList": {
            "ConnectionDo": [
                {
                    "ClientAddr": "30.5.121. **",
                    "Language": "JAVA",
                    "Version": "V4_3_6",
                    "ClientId": "30.5.121. **@24813#-1999745829#-1737591554#453111174894656"
                }
            ]
        }
    },
    "RequestId": "DE4140C7-F42D-473D-A5FF-B1E31692****"
}

Error codes

For a list of error codes, visit the API Error Center.

Operations in the console

In addition to calling the OnsConsumerGetConnection operation, you can query the connection information of consumers of a specified group ID in the Message Queue for Apache RocketMQ console. For more information, see View the status of consumers.