You can call this operation to query the connection status of consumer instances with a specified group ID.

This operation is used to determine whether the consumers with the specified group ID are online and to query the connection details about the consumer instances.

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 OnsConsumerGetConnection

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

GroupId String Yes GID_test_consumer_id

The consumer group ID that you want to query.

InstanceId String Yes MQ_INST_111111111111_DOxxxxxx

The ID of the Message Queue for Apache RocketMQ instance corresponding to the consumer group ID.

Response parameters

Parameter Type Example Description
Data Struct

The data structure of returned parameters.

ConnectionList Array

Connection information of consumer instances with 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 development language used by the consumer instance.

Version String V4_3_6

The version of the consumer instance.

RequestId String DE4140C7-F42D-473D-A5FF-B1E3169245F2

The ID of the request. This is a common parameter.

Examples

Sample requests

http(s)://[Endpoint]/? 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-B1E3169245F2</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-B1E3169245F2"
}

Error codes

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