Modifies the parameters of a queue.

Authorization

By default, only Alibaba Cloud accounts can call this operation. RAM users can call this operation only after these RAM users are granted related permissions. The following table describes the authorization information of this operation. For more information, see Permission policies and examples.

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

Request

A request consists of the following parts:

  • Request line

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

  • URI parameters

    To modify the parameters of a queue, you can specify metaoverride=true in the URI.

  • Operation-specific request headers

    None.

  • Request Body

    The request body is in the XML format. The parameters of the queue can be included in the request body. All the parameters are optional.

    Parameter Type Required Example Description
    DelaySeconds Integer No 0 The delay period after which all messages sent to the queue can be consumed.

    Valid values: 0 to 604800. Unit: seconds.

    Default value: 0.

    MaximumMessageSize Integer No 1024 The maximum size of the message body that can be sent to the queue.

    Valid values: 1024 to 65536. Unit: bytes.

    Default value: 65536.

    MessageRetentionPeriod Integer No 120 The maximum period for which a message can be retained in the queue. A message that is sent to the queue can be retained for a specified period. After the specified period ends, the message is deleted no matter whether it is consumed.

    Valid values: 60 to 604800. Unit: seconds.

    Default value: 345600.

    VisibilityTimeout Integer No 60 The invisibility period for which the received message remains the Inactive state.

    Valid values: 1 to 43200. Unit: seconds.

    Default value: 30.

    PollingWaitSeconds Integer No 0 The maximum period for which a ReceiveMessage request waits if no message is available in the queue.

    Valid values: 0 to 30. Unit: seconds.

    Default value: 0.

    LoggingEnabled Boolean No True Specifies whether to enable the log management feature.
    Valid values:
    • True: enables the log management feature.
    • False: disables the log management feature.

    Default value: False.

Response

A 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

    PUT /queues/$queueName?Metaoverride=true HTTP/1.1
    Host: $AccountId.mns.cn-hangzhou.aliyuncs.com
    Date: Wed, 08 Mar 2012 12:00:00 GMT
    x-mns-version: 2015-06-06
    Authorization: MNS 15B4D3461F177624206A:xQE0diMbLRepdf3YB+FIEXAM****

    <?xml version="1.0" encoding="UTF-8"?>
    <Queue xmlns="http://mns.aliyuncs.com/doc/v1/">
        <VisibilityTimeout >60</VisibilityTimeout>
        <MaximumMessageSize>1024</MaximumMessageSize>
        <MessageRetentionPeriod>120</MessageRetentionPeriod>
        <DelaySeconds>30</DelaySeconds>
        <LoggingEnabled>True</LoggingEnabled>
    </Queue>          

Sample success responses

    HTTP/1.1 204 No Content
    x-mns-request-id:512B2A634403E52B1956****
    x-mns-version: 2015-06-06            

Error codes

Error code Error message HTTP status code Description
InvalidArgument The value of Element should between Low and High seconds/bytes. 400 The error message returned because the parameter value is invalid. Make sure that the value is in the value range.
QueueNotExist The queue name you provided is not exist. 404 The error message returned because the specified queue does not exist. Create a queue.