ALIYUN::AMQP::Queue

更新时间:
复制 MD 格式

You can use ALIYUN::AMQP::Queue to create a queue.

Syntax

{
  "Type": "ALIYUN::AMQP::Queue",
  "Properties": {
    "DeadLetterExchange": String,
    "MaximumPriority": Number,
    "InstanceId": String,
    "ExclusiveState": Boolean,
    "DeadLetterRoutingKey": String,
    "VirtualHost": String,
    "MaxLength": Number,
    "AutoDeleteState": Boolean,
    "QueueName": String,
    "MessageTTL": Number,
    "AutoExpireState": Number
  }
}

Properties

Property Name

Type

Required

Update allowed

Description

Constraints

InstanceId

String

Yes

No

The instance ID.

None

QueueName

String

Yes

No

The name of the queue.

The name of the queue must meet the following requirements:

  • The name can contain letters, digits, hyphens (-), underscores (_), periods (.), number signs (#), forward slashes (/), and at signs (@). The name must be 1 to 255 characters in length.

  • The queue name cannot be changed after the queue is created. To change the name, delete the queue and create a new one.

VirtualHost

String

Yes

No

The vhost name.

The name can contain letters, digits, hyphens (-), underscores (_), periods (.), number signs (#), forward slashes (/), and at signs (@).

The length must be 1 to 255 characters.

AutoDeleteState

Boolean

No

No

Specifies whether to automatically delete the queue.

Valid values:

  • true: Automatic deletion is enabled.

    The queue is automatically deleted after the last consumer unsubscribes from it.

  • false: The item is not deleted automatically.

AutoExpireState

Number

No

No

The automatic expiration time of the queue.

The queue is automatically deleted if it is not accessed within the specified time.

Note

This feature must be enabled before you can use this parameter. To enable this feature, submit a ticket.

DeadLetterExchange

String

No

No

The dead-letter exchange.

This type of exchange is used to receive rejected messages.

If a consumer rejects a message and the message is not requeued, ApsaraMQ for RabbitMQ routes the message to the specified dead-letter exchange. The dead-letter exchange then routes the message to a bound queue for storage.

DeadLetterRoutingKey

String

No

No

The dead-letter routing key.

The key can contain letters, digits, hyphens (-), underscores (_), periods (.), number signs (#), forward slashes (/), and at signs (@).

The length must be 1 to 255 characters.

ExclusiveState

Boolean

No

No

Specifies whether the exchange is exclusive.

Valid values:

  • true: The exchange is exclusive.

    An exclusive Exchange can be used only by the Connection that declared it. It is automatically deleted when the Connection closes.

  • false: Specifies that the Exchange is not exclusive.

MaximumPriority

Number

No

No

Priorities are not a supported feature.

None

MaxLength

Number

No

No

The maximum number of messages that can be stored in the queue.

This parameter is not supported in the current version.

If the maximum number of messages is exceeded, the earliest messages in the queue are deleted.

MessageTTL

Number

No

No

The time-to-live (TTL) of messages in the queue.

Requirements:

  • A message expires if it is retained in the queue for longer than the specified TTL.

  • The TTL must be a non-negative integer. The maximum value is 1 day. The unit is milliseconds. For example, a TTL of 1000 means that a message can be retained in the queue for a maximum of 1 second.

Return value

Fn::GetAtt

QueueName: The name of the queue.

Examples

YAML format

ROSTemplateFormatVersion: '2015-09-01'
Parameters:
  InstanceId:
    Type: String
    Description: The instance ID.
  VirtualHost:
    Type: String
    Description: The name of the virtual host.
  QueueName:
    Type: String
    Description: The name of the queue.
    MaxLength: 255
Resources:
  Queue:
    Type: ALIYUN::AMQP::Queue
    Properties:
      InstanceId:
        Ref: InstanceId
      VirtualHost:
        Ref: VirtualHost
      QueueName:
        Ref: QueueName
Outputs:
  QueueName:
    Description: The name of the queue.
    Value:
      Fn::GetAtt:
        - Queue
        - QueueName

JSON format

{
  "ROSTemplateFormatVersion": "2015-09-01",
  "Parameters": {
    "InstanceId": {
      "Type": "String",
      "Description": "The instance ID."
    },
    "VirtualHost": {
      "Type": "String",
      "Description": "The name of the virtual host."
    },
    "QueueName": {
      "Type": "String",
      "Description": "The name of the queue.",
      "MaxLength": 255
    }
  },
  "Resources": {
    "Queue": {
      "Type": "ALIYUN::AMQP::Queue",
      "Properties": {
        "InstanceId": {
          "Ref": "InstanceId"
        },
        "VirtualHost": {
          "Ref": "VirtualHost"
        },
        "QueueName": {
          "Ref": "QueueName"
        }
      }
    }
  },
  "Outputs": {
    "QueueName": {
      "Description": "The name of the queue.",
      "Value": {
        "Fn::GetAtt": [
          "Queue",
          "QueueName"
        ]
      }
    }
  }
}