Deleting a Message

Last updated: 2019-07-05 12:25:57

1. API Description

This API (DeleteMessage) is used to delete message that has already been consumed. The consumer needs to use the ReceiptHandle (obtained after the last consume operation) as parameter to locate the message to be deleted. You can only execute this operation before NextVisibleTime. Message will return to Active status after NextVisibleTime and ReceiptHandle will become invalid, causing deletion operation to fail. In this case, you will need to re-consume the message and acquire ReceiptHandle again. Under concurrent consuming scenario, if a message is deleted by one of the consumers, the other consumers will no longer be able to obtain the deleted message.

Domain for public network API

Domain for private network API

At any time (including alpha test), any downstream traffic generated when using public network domain will incur traffic fee. It is strongly recommended that users on Tencent Cloud use private network domain, as it will not incur any traffic fee.

  • The "region" should be replaced by a specific region: gz (Guangzhou), sh (Shanghai), bj (Beijing). The "region" value in the common parameter should be kept consistent with that in the domain. In case of inconsistency, the one in the domain should prevail. The request should be sent to the region specified by the domain.
  • Requests for accessing via public network domain support both HTTP and HTTPS. Requests for accessing via private network only support HTTP.
  • Some of the input parameters are optional, so the default values are not required.
  • All output parameters will be returned to the user when the request is successful; otherwise, at least code, message, and requestId will be returned.

2. Input Parameters

The following request parameter list only provides API request parameters. For other parameters, refer to Common Request Parameters.

Parameter Name Required Type Description
queueName Yes String Queue name. This is unique under the same account in one region. The name of queue is a string with no more than 64 characters. It must start with letter, and the rest may contain letters, numbers and dashes (-).
receiptHandle Yes String Unique receipt handle that is returned when the message is consumed for the previous time. This is used to delete message.

3. Output Parameters

Parameter Name Type Description
code Int 0: Succeeded, others: Error. For detailed errors, please refer to the table below.
message String Error message.
requestId String ID of the request generated by server. When there is an internal error on the server, users can submit this ID to backend to locate the problem.
Error Code Module Error Code Error Message Description
4430 10260 receipt handle is invalid Receipt handle is invalid. Refer to Delete Messages for the reasons for why handles become invalid.
4000 10470 receiptHandle error receiptHandle error. receiptHandle is a string

Note: The error codes listed in the above table are specific to the API. If the error code you are looking for is not here, you may find it in the Common Error Codes.

4. Example


 &<Common request parameters>


"code" : 0,
"message" : "",