Modifies the period after which a consumed message that remains in the Inactive state can be consumed again.

Name Value
API ChangeMessageVisibility
Action mns:ChangeMessageVisibility
Resource acs:mns:$region:$accountid:/queues/$queueName/messages

Description

You can call this operation to modify the period after which a consumed message that remains in the Inactive state can be consumed again. A new receipt handle that is returned after the value of the VisibilityTimeout parameter is modified.

Request

Each request consists of the following parts:

  • Request line

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

  • URI parameter
    Parameter Required Description
    ReceiptHandle Yes The receipt handle that was returned when the message was last consumed. For more information, see ReceiveMessage.
    VisibilityTimeout Yes The period after which the message can be consumed again. Unit: seconds.
  • Operation-specific request headers

    None.

  • Request Body

    None.

Response

Each response consists of the following parts:

  • HTTP Status Code

    HTTP/1.1 200 OK

  • Operation-specific response headers

    None.

  • Response Body
    Parameter Description
    ReceiptHandle The receipt handle that is returned after the value of the VisibilityTimeout parameter is modified. This receipt handle can be used to delete and modify the message that is in the Inactive state and remains valid before the time that is specified by the NextVisibleTime parameter.
    NextVisibleTime The time when the message can be consumed again. The value is a timestamp that follows the UNIX time format. It is the number of milliseconds that have elapsed since 00:00:00 Thursday, January 1, 1970.

Examples

Sample requests

PUT /queues/$queueName/messages
? receiptHandle=MbZj6wDWli+QEauMZc8ZRv37sIW2iJKq3M9Mx/KSbkJ0&visibilityTimeout=50 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 200 OK
x-mns-request-id:512B2A634403E52B1956****
x-mns-version: 2015-06-06

<? xml version="1.0" encoding="UTF-8"? >
<ChangeVisibility xmlns="http://mns.aliyuncs.com/doc/v1/">
    <ReceiptHandle>TbZj6wDWli+9CEauMZc8ZRv37sIW2iJKq3M9Mx/TS1</ReceiptHandle >
    <NextVisibleTime>1250700979298000</NextVisibleTime>
</ChangeVisibility>            

Special error

Error code Error message HTTP 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