All Products
Search
Document Center

ChangeMessageVisibility

Last Updated: Jul 23, 2019

Description

This interface is used to modify the next consumable time of a message which has been consumed and is still in Inactive status. After VisibilityTimeout of the message is modified successfully, a new ReceiptHandle is returned.

Request

A request mainly includes the following parts:

  • Request line

    PUT /queues/$queueName/messages?receiptHandle=<receiptHandle>&visibilityTimeout=<visibilitytimeout> HTTP/1.1

  • URI parameter

Parameter Name Description Required?
ReceiptHandle ReceiptHandle returned by the previous consumption. For details, see “ReceiveMessage Interface” Required
VisibilityTimeout Interval between the current time and the next consumable time, measured in seconds Required
  • Special Request Header

    None. See “Public Request Headers”.

  • Request Body

    None.

Response

The returned message includes 3 parts: returned status line, HTTP header and message body.

  • HTTP Status Code

    HTTP/1.1 200 OK

  • Special Response Header

    None. See Public Returned Headers.

  • Response Body

Parameter Name Description
ReceiptHandle Temporary handle returned after VisibilityTimeout of the message is modified, which is used to delete or modify the message in Inactive status and is valid before NextVisibleTime.
NextVisibleTime Time when a message can be consumed again, represented in milliseconds that have elapsed since 1970-1-1 0:00.

Special Error

Error Code Error Message Status Code
QueueNotExist The queue name you provided is not exist. 404
InvalidArgument The value of Element should between Low and High seconds/bytes. 400
MessageNotExist Message not exist. 404

Request example:

  1. PUT /queues/$queueName/messages
  2. ?receiptHandle=MbZj6wDWli+QEauMZc8ZRv37sIW2iJKq3M9Mx/KSbkJ0&visibilityTimeout=50 HTTP/1.1
  3. Host: $AccountId.mns.cn-hangzhou.aliyuncs.com
  4. Date: Wed, 28 May 2012 22:32:00 GMT
  5. x-mns-version: 2015-06-06
  6. Authorization: MNS 15B4D3461F177624206A:xQE0diMbLRepdf3YB+FIEXAMPLE

Response example:

  1. HTTP/1.1 200OK
  2. x-mns-request-id:512B2A634403E52B1956133E
  3. x-mns-version: 2015-06-06
  4. <?xml version="1.0" encoding="UTF-8" ?>
  5. <Message xmlns="http://mns.aliyuncs.com/doc/v1/">
  6. <ReceiptHandle>
  7. TbZj6wDWli+9CEauMZc8ZRv37sIW2iJKq3M9Mx/TS1
  8. </ReceiptHandle >
  9. <NextVisibleTime>1250700979298000</NextVisibleTime>
  10. </Message>