You can call this operation to delete a specified topic under your account.

You can call the OnsTopicDelete operation when resources are recycled, for example, when applications are deprecated. After a topic is deleted, the Message Queue for Apache RocketMQ backend recycles resources of the topic. This process is time-consuming. Therefore, we recommend that you do not create a topic immediately after deleting one. If the deletion fails, take measures based on the returned error code.

Note the following when calling the OnsTopicDelete operation:

  • By default, only Alibaba Cloud accounts can call this operation. Resource Access Management (RAM) users can call this operation only after being authorized.
  • If a topic is deleted, all published subscriptions under the topic are cleared. Proceed with caution.

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_111111111111_DOxxxxxx

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

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

The ID of the request. This is a common parameter that facilitates troubleshooting and fault locating.

Examples

Sample requests

http(s)://[Endpoint]/? Action=OnsTopicDelete
&InstanceId=MQ_INST_111111111111_DOxxxxxx
&Topic=test
&<Common request parameters>

Sample success responses

XML format

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

JSON format

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

Error codes

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