You can call this operation to query the total number of messages in the current topic and the time when the topic was last updated.

This operation is used to determine the resource usage of the topic. The information returned for this operation includes the total number of messages in the topic on the current Message Queue for Apache RocketMQ broker and the time when messages were last written to the topic.


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 OnsTopicStatus

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

InstanceId String Yes MQ_INST_111111111111_DOxxxxxx

The ID of the Message Queue for Apache RocketMQ instance corresponding to the topic that you want to query.

Topic String Yes test

The name of the topic that you want to query.

Response parameters

Parameter Type Example Description
Data Struct

The returned data structure of the queried topic.

LastTimeStamp Long 1570864984364

The time when the current topic was last updated.

Perm Integer 6

The ID of the relationship between the API caller and the topic. Valid values:

  • 2: The API caller can publish the topic.
  • 4: The API caller can subscribe to the topic.
  • 6: The API caller can publish and subscribe to the topic.
TotalCount Long 2310

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

RequestId String 427EE49D-D762-41FB-8F3D-9BAC96C314B4

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


Sample requests

http(s)://[Endpoint]/? Action=OnsTopicStatus
&<Common request parameters>

Sample success responses

XML format


JSON format

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

Error codes

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