CreateQueue

Method for creating a new standard or FIFO queue.

By default, a standard queue is created. To create a FIFO queue, use the FifoQueue parameter.

Note

You cannot change the type of a created queue from standard to FIFO. To change the type, either create a new queue, or delete the old one and re-create it as a FIFO queue.

If a queue is re-created with the same name, it will be assigned a new QueueUrl different from the old one.

If you deleted a queue, you can create another queue with the same name after 60 seconds.

The queue name must be unique within the folder and cannot exceed 80 characters. You can use numbers, letters, underscores, and hyphens in the name. The name of a FIFO queue must end with the .fifo suffix.

Note

Always store the queue URL in the system in exactly the same form in which it is returned by Message Queue when the queue is created. Don't form a URL out of individual parts, because they may change.

Request

Request parameters

Parameter Type Required parameter Description
QueueName string Yes Queue name. The maximum length is 80 characters. You can use numbers, letters, underscores, and hyphens in the name. The name of a FIFO queue must end with the .fifo suffix.
Attributes.N.* list of attributes No List of queue attributes.

Attributes

Queue attributes. Attributes are sent as a list. For more information about passing list parameters, see Using the API.

Attribute.N.Name (attribute)
Attribute.N.Value (attribute value)
Attribute Type Description
DelaySeconds integer Number of seconds to delay the message from being available for processing. Valid values: from 0 to 900 seconds (15 minutes). Default: 0.
MaximumMessageSize integer Maximum message size in bytes. Valid values: from 1024 bytes (1 KB) to 262144 bytes (256 KB). Default: 262144 (256 KB).
MessageRetentionPeriod integer The length of time in seconds to retain a message. Valid values: from 60 seconds (1 minute) to 1209600 seconds (14 days). Default: 345600 (4 days).
ReceiveMessageWaitTimeSeconds integer Wait time for the ReceiveMessage method, in seconds. Valid values: from 0 to 20 seconds. Default: 0.
RedrivePolicy string Message redrive policy in Dead Letter Queue. The source queue and DLQ must be the same type: for FIFO queues, the DLQ must also be a FIFO queue. It includes two parameters:
  • deadLetterTargetArn is the ARN queue messages are redriven to. You can get the queue's ARN by calling the GetQueueAttributes method.
  • maxReceiveCount is the maximum number of attempts to read a message from the queue before redriving it to the DLQ. When the ReceiveCount value for the message exceeds the value of maxReceiveCount, the message is moved to the DLQ.
VisibilityTimeout integer Visibility timeout for messages in a queue, specified in seconds. Valid values: from 0 to 43000 seconds. Default: 30.

FIFO queue attributes

Attribute Description
FifoQueue Returns whether the queue is FIFO.

Valid values: true or false.

If this parameter is not used, a standard queue is created. You cannot change the parameter value for a created queue. When sending messages to a FIFO queue, explicitly specify their MessageGroupId.

ContentBasedDeduplication Enables content-based deduplication. Valid values: true or false.

Non-supported attributes

Attribute Type Description
KmsMasterKeyId string Not supported in Yandex Message Queue.
KmsDataKeyReusePeriodSeconds string Not supported in Yandex Message Queue.

Response

Successful response fields

Field Type Description
QueueUrl string URL of a created queue.

CreateQueue errors

For a list of errors common for all methods, see Common errors.

HTTP Error code Description
400 QueueDeletedRecently A queue with the same name has been deleted recently. You can create another queue with the same name 60 seconds after deleting the old one.
400 QueueAlreadyExists The queue with the specified name already exists.

Sample request

Action=CreateQueue
&Version=2012-11-05
&QueueName=sample-queue-2
&Attribute.1.Name=VisibilityTimeout
&Attribute.1.Value=30

For more information about forming requests, see General API request format.

Response example

<CreateQueueResponse>
    <CreateQueueResult>
        <QueueUrl>
            https://message-queue.api.cloud.yandex.net/b1g8ad42m6he1ooql78r/dj600000000000le07ol/sample-queue
        </QueueUrl>
    </CreateQueueResult>
    <ResponseMetadata>
        <RequestId>
            e4c69a67-f2809a49-6b326386-14d2a08-af8eb419750efa1dbcabf1848a01aefd
        </RequestId>
    </ResponseMetadata>
</CreateQueueResponse>