All Products
Search
Document Center

Simple Message Queue (formerly MNS):DeleteMessage

最終更新日:Sep 02, 2024

Deletes a message that has been consumed.

NameValue
APIDeleteMessage
Actionmns:DeleteMessage
Resourceacs:mns:$region:$accountid:/queues/$queueName/messages

Description

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.

Request

Each request consists of the following parts:

  • Request line

    DELETE /queues/$queueName/messages? ReceiptHandle=<receiptHandle> HTTP/1.1

  • Operation-specific URI parameter

    ParameterDescriptionRequired
    ReceiptHandleThe receipt handle that was returned when the message was last consumed. For more information, see ReceiveMessage.Yes
  • Operation-specific request headers

    None.

  • Request Body

    None.

Response

Each response consists of the following parts:

  • HTTP Status Code

    HTTP/1.1 204 No Content

  • Operation-specific response headers

    None.

  • Response Body

    None.

Examples

Sample requests

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           

Special Error

Error codeError messageHTTP status code
QueueNotExistThe queue name you provided is not exist.404
InvalidArgumentThe value of Element should between Low and High seconds/bytes.400
ReceiptHandleErrorThe receipt handle you provide is not valid.400