Queries the parameters of a queue. The operation returns the parameters that were specified when the queue was created. The operation also returns the time when the queue was created, the time when the queue was last modified, and the approximate numbers of different types of messages.

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.

Item Value
API operation GetQueueAttributes
Action mns:GetQueueAttributes
Resource acs:mns:$region:$accountid:/queues/$queueName

Request

A request consists of the following parts:

  • Request line

    GET /queues/$queueName HTTP/1.1

  • Operation-specific request headers

    None.

  • Response body

    None.

Response

A response consists of the following parts:

  • HTTP status code

    HTTP/1.1 200 OK

  • Operation-specific response headers

    None.

  • Request body

    The response body is in the XML format. The syntax of the response body is <Queue>Queue parameter list</Queue>.

    Parameter Type Example Description
    QueueName String demo-queue The name of the queue.
    CreateTime Long 1250700999 The time when the queue was created. This value is a UNIX timestamp representing the number of milliseconds that have elapsed since the epoch time January 1, 1970, 00:00:00 UTC.
    LastModifyTime Long 1250700999 The time when the queue was last modified. This value is a UNIX timestamp representing the number of milliseconds that have elapsed since the epoch time January 1, 1970, 00:00:00 UTC.
    DelaySeconds Integer 30 The delay period after which all messages that are sent to the queue can be consumed. Unit: seconds.
    MaximumMessageSize Integer 65536 The maximum size of a message body that can be sent to the queue. Unit: bytes.
    MessageRetentionPeriod Integer 65536 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. Unit: seconds.
    PollingWaitSeconds Integer 0 The maximum period for which a ReceiveMessage request waits if no message is available in the queue. Unit: seconds.
    ActiveMessages Integer 20 The total number of messages that are in the Active state in the queue. The value is an approximate number.
    InactiveMessages Int 0 The total number of the messages that are in the Inactive state in the queue. The value is an approximate number.
    DelayMessages Int 0 The total number of the messages that are in the Delayed state in the queue. The value is an approximate number.
    LoggingEnabled Boolean True Indicates whether the log management feature is enabled for the queue. Valid values:
    • True: The log management feature is enabled.
    • False: The log management feature is disabled.

Examples

Sample requests

    GET /queues/$queueName 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****

Sample success responses

    HTTP/1.1 200 OK
    Content-Type=text/xml;charset=utf-8
    Content-Length:145
    x-mns-request-id:512B2A634403E52B1956****
    x-mns-version: 2015-06-06

    <?xml version="1.0" encoding="UTF-8"?>
    <Queue xmlns="http://mns.aliyuncs.com/doc/v1/">
        <QueueName>demo-queue</QueueName >
        <CreateTime>1250700999</CreateTime >
        <LastModifyTime>1250700999</LastModifyTime>
        <VisibilityTimeout>60</VisibilityTimeout >
        <MaximumMessageSize>65536</MaximumMessageSize>
        <MessageRetentionPeriod>65536</MessageRetentionPeriod>
        <DelaySeconds>30</DelaySecond>
        <PollingWaitSeconds>0</PollingWaitSeconds>
        <InactiveMessages>0</InactiveMessages>
        <ActiveMessages>20</ActiveMessages>
        <DelayMessages>0</DelayMessages>
        <LoggingEnabled>True</LoggingEnabled>
    </Queue>            

Error codes

Error code Error message HTTP status code Description
QueueNotExist The queue name you provided is not exist. 404 The error message returned because the specified queue does not exist. Create a queue.