All Products
Search
Document Center

ApsaraMQ for RocketMQ:OnsTopicSubDetail

Last Updated:Jan 06, 2026

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.

Try it now

Try this API in OpenAPI Explorer, no manual signing needed. Successful calls auto-generate SDK code matching your parameters. Download it with built-in credential security for local usage.

Test

RAM authorization

The table below describes the authorization required to call this API. You can define it in a Resource Access Management (RAM) policy. The table's columns are detailed below:

  • Action: The actions can be used in the Action element of RAM permission policy statements to grant permissions to perform the operation.

  • API: The API that you can call to perform the action.

  • Access level: The predefined level of access granted for each API. Valid values: create, list, get, update, and delete.

  • Resource type: The type of the resource that supports authorization to perform the action. It indicates if the action supports resource-level permission. The specified resource must be compatible with the action. Otherwise, the policy will be ineffective.

    • For APIs with resource-level permissions, required resource types are marked with an asterisk (*). Specify the corresponding Alibaba Cloud Resource Name (ARN) in the Resource element of the policy.

    • For APIs without resource-level permissions, it is shown as All Resources. Use an asterisk (*) in the Resource element of the policy.

  • Condition key: The condition keys defined by the service. The key allows for granular control, applying to either actions alone or actions associated with specific resources. In addition to service-specific condition keys, Alibaba Cloud provides a set of common condition keys applicable across all RAM-supported services.

  • Dependent action: The dependent actions required to run the action. To complete the action, the RAM user or the RAM role must have the permissions to perform all dependent actions.

Action

Access level

Resource type

Condition key

Dependent action

mq:QueryTopicSubDetail

get

Topic

acs:mq:{#regionId}:{#accountId}:{#TopicName}

Topic

acs:mq:{#regionId}:{#accountId}:{#InstanceId}%{#TopicName}

None
  • mq:OnsInstanceBaseInfo

Request parameters

Parameter

Type

Required

Description

Example

InstanceId

string

Yes

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

MQ_INST_111111111111_DOxxxxxx

Topic

string

Yes

The name of the topic that you want to query.

test

Response elements

Element

Type

Description

Example

object

RequestId

string

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****

Data

object

The data returned.

SubscriptionDataList

object

SubscriptionDataList

array<object>

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

object

GroupId

string

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

GID_test

MessageModel

string

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

SubString

string

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

*

Online

string

Indicates whether the consumer group is online.

true

Topic

string

The topic name.

test

Examples

Success response

JSON format

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

Error codes

See Error Codes for a complete list.

Release notes

See Release Notes for a complete list.