閱讀832 返回首頁    go iPhone_iPad_Mac_手機_平板_蘋果apple


批量刪除消息__隊列接口規範_API使用手冊_消息服務-阿裏雲

描述

該接口用於批量刪除隊列多條消息,最多可以刪除16條消息,每條消息需要傳入相應的ReceiptHandle。建議此接口與 BatchReceiveMessage 搭配使用,效率會更高。批量操作的結果可能同時包含成功和失敗的子請求。隻有全部子請求都成功時,HTTP狀態碼才是204。當部分失敗發生時,用戶需檢查響應中每個消息的錯誤信息。

Request

Request的構造主要由以下幾個部分組成:

  • 請求行

    DELETE /queues/$queueName/messages HTTP/1.1

  • 特有Request Header

    無,請參考 調用方式/公共參數

  • Request Body

    Request Body為 XML 格式,其中包含多條消息的 ReceiptHandle。

Response

返回消息由返回狀態行,HTTP頭和消息體三部分組成。

  • HTTP Status Code

    HTTP/1.1 204 NoContent

  • 特有Response Header

    無,請參考 調用方式/公共參數

  • Response Body

Special Error

錯誤代碼 錯誤消息 狀態碼
QueueNotExist The queue name you provided is not exist. 404
InvalidArgument The value of Element should between Low and High seconds/bytes. 400
ReceiptHandleError The receipt handle you provide is not valid. 400

請求示例:

  1. DELETE /queues/$queueName/messages HTTP/1.1
  2. Host: $AccountId.mns.cn-hangzhou.aliyuncs.com
  3. Date: Wed, 28 May 2012 22:32:00 GMT
  4. x-mns-version: 2015-06-06
  5. Authorization: MNS 15B4D3461F177624206A:xQE0diMbLRepdf3YB+FIEXAMPLE
  6. <?xml version="1.0" encoding="UTF-8"?>
  7. <ReceiptHandles xmlns="https://mns.aliyuncs.com/doc/v1/">
  8. <ReceiptHandle>1-ODU4OTkzNDU5My0xNDM1MTk3NjAwLTItNg==</ReceiptHandle>
  9. <ReceiptHandle>1-ODU4OTkzNDU5NC0xNDM1MTk3NjAwLTItNg==</ReceiptHandle>
  10. <ReceiptHandle>1-ODU4OTkzNDU5NS0xNDM1MTk3NjAwLTItNg==</ReceiptHandle>
  11. </ReceiptHandles>

返回示例:

  • 正常刪除所有消息

    1. HTTP/1.1 204 No Content
    2. x-mns-request-id:512B2A634403E52B1956133E
    3. x-mns-version: 2015-06-06
  • 部分消息刪除失敗

    1. HTTP/1.1 404
    2. Connection:close
    3. Content-Type=text/xml;charset=utf-8
    4. Content-Length:500
    5. x-mns-request-id:512B2A634403E52B1956133E
    6. x-mns-version: 2015-06-06
    7. <?xml version="1.0" encoding="UTF-8"?>
    8. <Errors xmlns="https://mns.aliyuncs.com/doc/v1/">
    9. <Error>
    10. <ErrorCode>MessageNotExist</ErrorCode>
    11. <ErrorMessage>Message not exist.</ErrorMessage>
    12. <ReceiptHandle>1-ODU4OTkzNDU5My0xNDM1MTk3NjAwLTItNg==</ReceiptHandle>
    13. </Error>
    14. <Error>
    15. <ErrorCode>MessageNotExist</ErrorCode>
    16. <ErrorMessage>Message not exist.</ErrorMessage>
    17. <ReceiptHandle>1-ODU4OTkzNDU5NC0xNDM1MTk3NjAwLTItNg==</ReceiptHandle>
    18. </Error>
    19. </Errors>

最後更新:2016-11-23 17:16:09

  上一篇:go 批量消費消息__隊列接口規範_API使用手冊_消息服務-阿裏雲
  下一篇:go 查看消息__隊列接口規範_API使用手冊_消息服務-阿裏雲