All Products
Search
Document Center

SetQueueAttributes

Last Updated: Jul 23, 2019

Description

This interface is used to modify attributes of a message queue.

Request

A request mainly includes the following parts:

  • Request line

    PUT /queues/$queueName?metaoverride=true HTTP/1.1

  • URI parameter

    metaoverride=true: the attributes of the message queue will be modified.

  • Special Request Header

    None. See “Public Request Headers”.

  • Request Body

    Request Body, which contains all the optinonal attributes of the created queue,is in XML format.

Parameter Name Description Parameter Value
DelaySeconds It is measured in seconds. All messages sent to the queue can be consumed until the DelaySeconds expires. An integer between 0 and 604800 (7 days). The default value is 0
MaximumMessageSize Maximum body length of a message sent to the queue, measured in bytes. An integer between 1024 (1K) and 65536 (64K). The default value is 65536 (64K).
MessageRetentionPeriod Maximum lifetime of the message in the queue, measured in seconds. After the time specified by this parameter expires, the message will be deleted no matter whether it has been consumed or not. An integer between 60 (1 minute) and 1296000 (15 days). The default value is 345600 (4 days)
VisibilityTimeout Duration in which a message stays in Inactive status after it is consumed from the queue. Measured in seconds. An integer between 1 and 43200 (12 hours). The default value is 30 (seconds)
PollingWaitSeconds It is the maximum time that a ReceiveMessage request could be waiting for any incoming messages, while there are no message in the queue. Measured in seconds. An integer between 0 and 30 seconds. The default value is 0 (seconds)

Response

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

  • HTTP Status Code

    HTTP/1.1 204 No Content

  • Special Response Header

    None. See “Public Return Headers”

  • Response Body

    None.

Special Error

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

Request example:

  1. PUT /queues/$queueName?Metaoverride=true HTTP/1.1
  2. Host: $AccountId.mns.cn-hangzhou.aliyuncs.com
  3. Date: Wed, 08 Mar 2012 12:00:00 GMT
  4. x-mns-version: 2015-06-06
  5. Authorization: MNS 15B4D3461F177624206A:xQE0diMbLRepdf3YB+FIEXAMPLE=
  6. <?xml version="1.0" encoding="UTF-8" ?>
  7. <Queue xmlns=”http://mns.aliyuncs.com/doc/v1/”>
  8. <VisibilityTimeout >60</VisibilityTimeout>
  9. <MaximumMessageSize>1024</MaximumMessageSize>
  10. <MessageRetentionPeriod>120</MessageRetentionPeriod>
  11. <DelaySeconds>30</DelaySeconds>
  12. </Queue>

Return example:

  1. HTTP/1.1 204 No Content
  2. x-mns-request-id:512B2A634403E52B1956133E
  3. x-mns-version: 2015-06-06