ALIYUN::MNS::Queue is used to create a queue to contain messages. Queues can be classified into standard and delayed queues.

If the DelaySeconds parameter is not specified when messages are sent, messages that are sent to standard queues can be immediately consumed. However, messages that are sent to delayed queues can be consumed only after the preset delay time.

Syntax

{
  "Type": "ALIYUN::MNS::Queue",
  "Properties": {
    "PollingWaitSeconds": Integer,
    "LoggingEnabled": Boolean,
    "MessageRetentionPeriod": Integer,
    "MaximumMessageSize": Integer,
    "DelaySeconds": Integer,
    "VisibilityTimeout": Integer,
    "QueueName": String
  }
}

Properties

PropertyTypeRequiredEditableDescriptionConstraint
QueueNameStringYes NoThe name of the MNS queue. The name must be unique to an Alibaba Cloud account in a region.

The name can be up to 256 characters in length and can contain letters, digits, and hyphens (-). It must start with a letter or digit.

DelaySeconds IntegerNoYes The delay time after which all messages that are sent to the queue can be consumed. Valid values: 0 to 604800 (7 days).

Unit: seconds.

Default value: 0.

MaximumMessageSizeIntegerNo Yes The maximum size of a message that can be sent to the queue. Valid values: 1024 (1 KB) to 65536 (64 KB).

Unit: bytes.

Default value: 65536 (64 KB).

MessageRetentionPeriodIntegerNo YesThe maximum lifetime of a message in the queue. After the time that is specified by this parameter expires, the message is deleted, regardless of whether the message has been consumed. Valid values: 60 (1 minute) to 604800 (7 days).

Unit: seconds.

Default value: 345600 (4 days).

VisibilityTimeoutIntegerNo Yes The duration for which a message stays in the Inactive state after it is consumed from the queue. Valid values: 1 to 43200 (12 hours).

Unit: seconds.

Default value: 30.

PollingWaitSecondsIntegerNo Yes The maximum time period that a ReceiveMessage request can wait till a message is in the queue.

Valid values: 0 to 10.

Unit: seconds.

Default value: 0.

LoggingEnabledBooleanNo Yes Specifies whether to enable the log management feature. Default value: false. Valid values:
  • true: The log management feature is enabled.
  • false: The log management feature is disabled.

Response parameters

Fn::GetAtt

  • QueueUrl: the URL of the queue.
  • ARN.WithSlash: the ARN of the queue.
  • QueueName: the name of the queue.

Examples

  • YAMLformat

    ROSTemplateFormatVersion: '2015-09-01'
    Parameters: {}
    Resources:
      Queue:
        Type: ALIYUN::MNS::Queue
        Properties:
          QueueName: TestQueue
          MessageRetentionPeriod: 345600
    Outputs:
      QueueName:
        Description: Queue name
        Value:
          Fn::GetAtt:
            - Queue
            - QueueName
      ARN:
        Description: The ARN for ALIYUN::ROS::CustomResource
        Value:
          Fn::GetAtt:
            - Queue
            - ARN
      ARN.WithSlash:
        Description: 'The ARN: acs:mns:$region:$accountid:/queues/$queueName'
        Value:
          Fn::GetAtt:
            - Queue
            - ARN.WithSlash
      QueueUrl:
        Description: URL of created queue
        Value:
          Fn::GetAtt:
            - Queue
            - QueueUrl
  • JSONformat

    {
      "ROSTemplateFormatVersion": "2015-09-01",
      "Parameters": {
      },
      "Resources": {
        "Queue": {
          "Type": "ALIYUN::MNS::Queue",
          "Properties": {
            "QueueName": "TestQueue",
            "MessageRetentionPeriod": 345600
          }
        }
      },
      "Outputs": {
        "QueueName": {
          "Description": "Queue name",
          "Value": {
            "Fn::GetAtt": [
              "Queue",
              "QueueName"
            ]
          }
        },
        "ARN": {
          "Description": "The ARN for ALIYUN::ROS::CustomResource",
          "Value": {
            "Fn::GetAtt": [
              "Queue",
              "ARN"
            ]
          }
        },
        "ARN.WithSlash": {
          "Description": "The ARN: acs:mns:$region:$accountid:/queues/$queueName",
          "Value": {
            "Fn::GetAtt": [
              "Queue",
              "ARN.WithSlash"
            ]
          }
        },
        "QueueUrl": {
          "Description": "URL of created queue",
          "Value": {
            "Fn::GetAtt": [
              "Queue",
              "QueueUrl"
            ]
          }
        }
      }
    }

For more examples, visit Subscription.json and Subscription.yml. In the examples, the ALIYUN::MNS::Topic, ALIYUN::MNS::Queue, and ALIYUN::MNS::Subscription resource types are involved.