Note:
This is a legacy API which has been hidden and will no longer be updated. We recommend using the new CMQ API 3.0 which is standardized and faster.
This API (BatchDeleteMessage) is used to delete messages that have been consumed in batches (a maximum of 16 messages can be deleted at a time). Consumers need to use the ReceiptHandle obtained after the last consumption as a parameter to locate the messages to be deleted.
This operation can only be successful before the NextVisibleTime; if the NextVisibleTime, message changes back to the Active state, the ReceiptHandle will become invalid, the deletion will fail, and the new ReceiptHandle needs to be re-consumed. When Concurrence consumes, if the message is deleted by one of the consumers, the other consumers will no longer be able to get the deleted message.
https://cmq-queue-{$region}.api.qcloud.com
http://cmq-queue-{$region}.api.tencentyun.com
The above {$region} in the domain name needs to be replaced with a specific region : gz (Guangzhou), sh (Shanghai), bj (Beijing), shjr (Shanghai Financial), szjr (Shenzhen Financial), hk (China Hong Kong), cd (Chengdu), ca (North American), usw (Maxi), sg (Singapore). The region value in the common parameters should be consistent with the region value of the domain name. If there is any inconsistency, the request will be sent to the region specified by the domain name region based on the region value of the domain name.
Note:
At any time (including during internal testing), if the public network downstream Traffic is generated by using a public network domain name, Traffic and cost will be charged. Therefore, users of the service on Tencent Cloud are strongly recommended to use it. Private network Domain name, private network will not produce Traffic cost.
The following request parameter list only lists the API request parameters. For other parameters, please see Common Request Parameters page.
Parameter name | Required | Type | Description |
---|---|---|---|
QueueName | Yes | String | Queue name, which is unique under the same account in a single region. The queue name is a string of no more than 64 characters, must begin with a letter, and the rest can contain letters, numbers, and dashes (-). |
ReceiptHandle.n | Yes | String | Message Handler returned when the message was last consumed. For the convenience of users, n can start with 0 or 1, but it must be continuous, such as deleting two messages, which can be (receiptHandle.0,receiptHandle.1) or (receiptHandle.1, receiptHandle.2). |
Parameter name | Type | Description |
---|---|---|
Code | Int | 0: successful, 4420: maximum QPS limit reached, 4440: queue does not exist, 6010: delete message part failed, 6020: delete message all failed. For more information on the meaning of other return values, please see Error Codes . |
Message | String | Error message. |
RequestId | String | Request ID generated by the server. When an internal error occurs on the server, the user can submit this ID to Backend Background to locate the problem. |
ErrorList | Array | Error list that could not be deleted successfully. Each element lists the error and reason why the message could not be successfully deleted. |
ErrorList is defined as follows:
Parameter name | Type | Description |
---|---|---|
Code | Int | 0: indicates success. Others: error. For more information, please see Common error code . |
Message | String | Error message. |
ReceiptHandle | String | Corresponding to the failed Message Handler deletion. |
Please check Common error code .
Enter:
Https://domain/v2/index.php?Action=BatchDeleteMessage & queueName=test-queue-123 & receiptHandle.1=3423452345 & receiptHandle.1=4364564575 & <Common Request Parameters>
Output (when all are successful):
{
"code" : 0,
"message" : "",
"requestId":"14534664555"
}
Output (in case of partial failure):
{
"code" : 6010,
"message" : "delete message partially failed",
"requestId":"14534664555",
"errorList":
[
{
"code" : 4430,
"message" : "invalid receiptHandle",
"receiptHandle":"4364564575"
}
]
}
문제 해결에 도움이 되었나요?