SetQueueAttributes

更新时间:
复制 MD 格式

You can call the SetQueueAttributes operation to modify the properties of a queue.

Authorization information

By default, only Alibaba Cloud accounts can call this operation. Resource Access Management (RAM) users can call this operation only after they are granted the required permissions. The following table describes the authorization information for this operation. For more information, see Authorization policies and examples.

Name

Value

API

SetQueueAttributes

RAM authorization operation

mns:SetQueueAttributes

Resource

acs:mns:$region:$accountid:/queues/$queueName

Request message

A request message consists of a request line, HTTP headers, and a message body:

  • Request line

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

  • URI parameters

    Use metaoverride=true to modify the properties of the message queue.

  • Request-specific headers

    None.

  • Request body

    The request body is in XML format and contains the properties of the queue. All of these properties are optional.

    Parameter

    Type

    Required

    Example

    Description

    DelaySeconds

    Integer

    No

    0

    The period of time after which a message sent to the queue can be consumed.

    Unit: seconds. Valid values: 0 to 604800.

    Default value: 0.

    MaximumMessageSize

    Integer

    No

    1024

    The maximum size of a message body that can be sent to the queue.

    Unit: bytes. Valid values: 1024 to 65536.

    Default value: 65536.

    MessageRetentionPeriod

    Integer

    No

    120

    The maximum time to live (TTL) for a message in the queue. After the specified period, the message is deleted, regardless of whether it has been retrieved.

    Unit: seconds. Valid values: 60 to 604800.

    Default value: 345600.

    VisibilityTimeout

    Integer

    No

    60

    The duration during which a message stays in the Inactive state after it is retrieved from the queue.

    Unit: seconds. Valid values: 1 to 43200.

    Default value: 30.

    PollingWaitSeconds

    Integer

    No

    0

    The maximum period of time that a ReceiveMessage request waits for a message if the queue is empty.

    Unit: seconds. Valid values: 0 to 30.

    Default value: 0.

    LoggingEnabled

    Boolean

    No

    True

    Specifies whether to enable the Log Management feature.

    Valid values:

    • True: enables the feature.

    • False: disables the feature.

    Default value: False.

    If you use Terraform to manage alicloud_message_service_queue, replace the LoggingEnabled parameter in the API with EnableLogging.

Response message

A response message consists of a status line, HTTP headers, and a message body:

  • HTTP status code

    HTTP/1.1 204 No Content

  • Response-specific headers

    None.

  • Response body

    None.

Examples

Request example:

    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>          

Response example:

    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 parameter value is invalid. Make sure that the parameter value is within the valid range.

QueueNotExist

The queue name you provided is not exist.

404

The queue does not exist. Create the queue first.