All Products
Search
Document Center

ApsaraMQ for RocketMQ:OnsTopicSubDetail

Last Updated:Mar 03, 2024

Queries the online consumer groups that subscribe to a specified topic.

Operation description

Note API operations provided by Alibaba Cloud are used to manage and query resources of Alibaba Cloud services. We recommend that you integrate these API operations only in management systems. Do not use these API operations in the core system of messaging services. Otherwise, system risks may occur.

You can call this operation to query the online consumer groups that subscribe to a specified topic. If all consumers in a group are offline, the information about the group is not returned.

Debugging

OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer.

Authorization information

The following table shows the authorization information corresponding to the API. The authorization information can be used in the Action policy element to grant a RAM user or RAM role the permissions to call this API operation. Description:

  • Operation: the value that you can use in the Action element to specify the operation on a resource.
  • Access level: the access level of each operation. The levels are read, write, and list.
  • Resource type: the type of the resource on which you can authorize the RAM user or the RAM role to perform the operation. Take note of the following items:
    • The required resource types are displayed in bold characters.
    • If the permissions cannot be granted at the resource level, All Resources is used in the Resource type column of the operation.
  • Condition Key: the condition key that is defined by the cloud service.
  • Associated operation: other operations that the RAM user or the RAM role must have permissions to perform to complete the operation. To complete the operation, the RAM user or the RAM role must have the permissions to perform the associated operations.
OperationAccess levelResource typeCondition keyAssociated operation
mq:QueryTopicSubDetailRead
  • All Resources
    *
    none
none

Request parameters

ParameterTypeRequiredDescriptionExample
InstanceIdstringYes

The ID of the instance that contains the topic you want to query.

MQ_INST_111111111111_DOxxxxxx
TopicstringYes

The name of the topic that you want to query.

test

Response parameters

ParameterTypeDescriptionExample
object
RequestIdstring

The ID of the request. This parameter is a common parameter. Each request has a unique ID. You can use this ID to troubleshoot issues.

87B6207F-2908-42B5-A134-84956DCA****
Dataobject

The data returned.

SubscriptionDataListobject []

The information about the online consumer groups that subscribe to the topic.

GroupIdstring

The ID of the consumer group that subscribes to the topic.

GID_test
MessageModelstring

The consumption mode. Valid values:

  • CLUSTERING: the clustering consumption mode
  • BROADCASTING: the broadcasting consumption mode

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

CLUSTERING
SubStringstring

The expression based on which consumers in the consumer group subscribe to the topic.

*
Topicstring

The topic name.

test

Examples

Sample success responses

JSONformat

{
  "RequestId": "87B6207F-2908-42B5-A134-84956DCA****",
  "Data": {
    "SubscriptionDataList": {
      "SubscriptionDataList": [
        {
          "GroupId": "GID_test",
          "MessageModel": "CLUSTERING",
          "SubString": "*"
        }
      ]
    },
    "Topic": "test"
  }
}

Error codes

For a list of error codes, visit the Service error codes.

Change history

Change timeSummary of changesOperation
No change history

View consumer groups that subscribe to a topic in the console

You can also view the information about the online consumer groups that subscribe to a topic in the ApsaraMQ for RocketMQ console. For more information, see View subscriptions.