OnsTopicSubDetail

Updated at: 2025-03-28 06:01

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

You can run this interface directly in OpenAPI Explorer, saving you the trouble of calculating signatures. After running successfully, OpenAPI Explorer can automatically generate SDK code samples.

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:
    • For mandatory resource types, indicate with a prefix of * .
    • 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
OperationAccess levelResource typeCondition keyAssociated operation
mq:QueryTopicSubDetailget
Topic
acs:mq:{#regionId}:{#accountId}:{#TopicName}
Topic
acs:mq:{#regionId}:{#accountId}:{#InstanceId}%{#TopicName}
    none
  • mq:OnsInstanceBaseInfo

Request parameters

ParameterTypeRequiredDescriptionExample
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
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 returned data.

SubscriptionDataListarray<object>

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

SubscriptionDataListobject
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.

*
Onlinestring

Indicates whether the consumer group is online.

true
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": "*",
          "Online": "true"
        }
      ]
    },
    "Topic": "test"
  }
}

Error codes

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

Change history

Change timeSummary of changesOperation
Change timeSummary of changesOperation
2025-03-21The response structure of the API has changedView Change Details

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.

  • On this page (1)
  • Operation description
  • Debugging
  • Authorization information
  • Request parameters
  • Response parameters
  • Examples
  • Error codes
  • Change history
  • View consumer groups that subscribe to a topic in the console
Feedback
phone Contact Us