Deletes a specified topic within your account.

Usage notes

You can call this operation when you need to recycle resources. For example, when applications are deleted, you need to recycle relevant resources.

After a topic is deleted, the backend of Message Queue for Apache RocketMQ recycles resources of the topic. This process is time-consuming. Therefore, we recommend that you do not create a topic immediately after you delete one. If a topic fails to be deleted, troubleshoot the issue based on the returned error code.

Note The operation to delete a topic results in the cleanup of all subscriptions under the topic. Proceed with caution.

QPS limit

The queries-per-second (QPS) limit on this operation is 1 per user. Throttling is triggered when the number of calls to this operation per second exceeds the QPS limit. Throttling may affect your business. Therefore, call this operation based on your needs. For more information, see QPS limits.

Authorization information

By default, only Alibaba Cloud accounts can call this operation. RAM users can call this operation only after they are authorized to use it. The following table lists the authorization information of this operation. For more information, see Policies and examples.

API

Action

Resource (with namespace)

Resource (without namespace)

OnsTopicDelete

mq:DeleteTopic

acs:mq:*:*:{instanceId}%{topic}

acs:mq:*:*:{topic}

Debugging

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 OnsTopicDelete

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

InstanceId String Yes MQ_INST_188077086902****_BXSuW61e

The ID of the instance from which you want to delete the topic.

Topic String Yes test

The name of the topic that you want to delete.

Response parameters

Parameter Type Example Description
RequestId String 4189D4A6-231A-4028-8D89-F66A76C1****

The ID of the request, which is a common parameter. Each request has a unique ID to facilitate troubleshooting and fault locating.

Operations in the console

In addition to calling the OnsTopicDelete operation, you can delete a topic in the Message Queue for Apache RocketMQ console. For more information, see Manage topics.

Examples

Sample requests

http(s)://ons.cn-zhangjiakou.aliyuncs.com/? Action=OnsTopicDelete
&InstanceId=MQ_INST_188077086902****_BXSuW61e
&Topic=test
&<Common request parameters>

Sample success responses

XML format

<OnsTopicDeleteResponse>
  <RequestId>4189D4A6-231A-4028-8D89-F66A76C1****</RequestId>
</OnsTopicDeleteResponse>

JSON format

{
    "RequestId": "4189D4A6-231A-4028-8D89-F66A76C1****"
}

Error codes

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