All Products
Search
Document Center

ApsaraMQ for RocketMQ:OnsTopicStatus

Last Updated:Mar 03, 2024

Queries the total number of messages in a topic and the status of the 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 determine the resource usage of a topic based on the information that is returned by this operation. The returned information includes the total number of messages in the topic and the most recent point in time when a message was published to the topic.

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:QueryTopicStatusRead
  • All Resources
    *
    none
none

Request parameters

ParameterTypeRequiredDescriptionExample
TopicstringYes

The name of the topic that you want to query.

test
InstanceIdstringYes

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

MQ_INST_188077086902****_BXSuW61e

Response parameters

ParameterTypeDescriptionExample
object

The message returned.

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.

427EE49D-D762-41FB-8F3D-9BAC96C3****
Dataobject

The data structure of the queried topic.

Perminteger

Indicates the operations that you can perform on the topic. Valid values:

  • 2: You can publish messages to the topic.
  • 4: You can subscribe to the topic.
  • 6: You can publish messages to and subscribe to the topic.
6
LastTimeStamplong

The point in time when the latest message is ready in the topic. If no message exists in the topic, the return value of this parameter is 0.

The value of this parameter is a UNIX timestamp in milliseconds.

For information about the definition of ready messages and ready time, see Terms .

1570864984364
TotalCountlong

The total number of messages in all partitions of the topic.

2310

Examples

Sample success responses

JSONformat

{
  "RequestId": "427EE49D-D762-41FB-8F3D-9BAC96C3****",
  "Data": {
    "Perm": 6,
    "LastTimeStamp": 1570864984364,
    "TotalCount": 2310
  }
}

Error codes

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

Change history

Change timeSummary of changesOperation
No change history