Deletes a message that has been consumed.
By default, only Alibaba Cloud accounts can call this operation. RAM users can call this operation only after these RAM users are granted related permissions. The following table describes the authorization information of this operation. For more information, see Permission policies and examples.
You can call this operation to delete a message that has been consumed. You must use
the receipt handle to identify the message. The receipt handle was returned after
the message was last consumed. You can delete the message only before the time that
is specified by the
NextVisibleTime parameter. After the specified time, the message changes to the Active state and
the receipt handle expires. To delete the message, you must retrieve a new receipt
handle after the message is consumed again.
A request consists of the following parts:
- Request line
DELETE /queues/$queueName/messages?ReceiptHandle=<receiptHandle> HTTP/1.1
Operation-specific URI parameters
Parameter Type Required Example Description ReceiptHandle String Yes MbZj6wDWli+QEauMZc8ZRv37sIW2iJKq3M9Mx/KSbkJ0 The receipt handle that was returned when the message was last consumed. For more information, see ReceiveMessage.
- Operation-specific request headers
- Request Body
A response consists of the following parts:
- HTTP Status Code
HTTP/1.1 204 No Content
- Operation-specific response headers
- Response Body
DELETE /queues/$queueName/messages?ReceiptHandle=MbZj6wDWli+QEauMZc8ZRv37sIW2iJKq3M9Mx/KSbkJ0 HTTP/1.1 Host: $AccountId.mns.cn-hangzhou.aliyuncs.com Date: Wed, 28 May 2012 22:32:00 GMT x-mns-version: 2015-06-06 Authorization: MNS 15B4D3461F177624206A:xQE0diMbLRepdf3YB+FIEXA****
Sample success responses
HTTP/1.1 204 No Content x-mns-request-id:512B2A634403E52B1956**** x-mns-version: 2015-06-06
|Error code||Error message||HTTP status code||Description|
|InvalidArgument||The value of Element should between Low and High seconds/bytes.||400||The error message returned because the value of the parameter is invalid. You must specify a valid value as prompted.|
|ReceiptHandleError||The receipt handle you provide is not valid.||400||The error message returned because the ReceiptHandle parameter is invalid.|
|QueueNotExist||The queue name you provided is not exist.||404||The error message returned because the specified queue does not exist. Create a queue.|
|MessageNotExist||The receipt handle you provided has expired.||404||The error message returned because you have not consumed a message within the invisibility period and the receipt handle of the message has expired. Consume messages within the invisibility period or specify a longer invisibility period.|