AWS services or capabilities described in AWS Documentation may vary by region/location. Click Getting Started with Amazon AWS to see specific differences applicable to the China (Beijing) Region.
CreateQueue
,
you provide a name for the queue. To successfully create a new queue, you must provide
a name that is unique within the scope of your own queues.
If you delete a queue, you must wait at least 60 seconds before creating a queue with the same name.
You may pass one or more attributes in the request. If you do not provide a value for any attribute, the queue will have the default value for that attribute. Permitted attributes are the same that can be set using SetQueueAttributes.
Use GetQueueUrl to get a queue's URL. GetQueueUrl requires only the
QueueName
parameter.
If you provide the name of an existing queue, along with the exact names and values
of all the queue's attributes, CreateQueue
returns the queue URL for
the existing queue. If the queue name, attribute names, or attribute values do not
match an existing queue, CreateQueue
returns an error.
param.n
notation. Values of n
are integers starting
from 1. For example, a parameter list with two elements looks like this: &Attribute.1=this
&Attribute.2=that
Namespace: Amazon.SQS.Model
Assembly: AWSSDK.dll
Version: (assembly version)
public class CreateQueueRequest : AmazonSQSRequest IRequestEvents
The CreateQueueRequest type exposes the following members
Name | Description | |
---|---|---|
CreateQueueRequest() | Empty constructor used to set properties independently even when a simple constructor is available | |
CreateQueueRequest(string) | Instantiates CreateQueueRequest with the parameterized properties |
Name | Type | Description | |
---|---|---|---|
Attributes | System.Collections.Generic.Dictionary<System.String, System.String> |
Gets and sets the property Attributes.
A map of attributes with their corresponding values.
The following lists the names, descriptions, and values of the special request parameters
the
|
|
QueueName | System.String |
Gets and sets the property QueueName.
The name for the queue to be created. |
This example shows how to create a queue.
var client = new AmazonSQSClient(); var attrs = new Dictionary<string, string>(); // Maximum message size of 256 KiB (1,024 bytes * 256 KiB = 262,144 bytes). int maxMessage = 256 * 1024; attrs.Add(QueueAttributeName.DelaySeconds, TimeSpan.FromSeconds(5).TotalSeconds.ToString()); attrs.Add(QueueAttributeName.MaximumMessageSize, maxMessage.ToString()); attrs.Add(QueueAttributeName.MessageRetentionPeriod, TimeSpan.FromDays(4).TotalSeconds.ToString()); attrs.Add(QueueAttributeName.ReceiveMessageWaitTimeSeconds, TimeSpan.FromSeconds(5).TotalSeconds.ToString()); attrs.Add(QueueAttributeName.VisibilityTimeout, TimeSpan.FromHours(12).TotalSeconds.ToString()); var request = new CreateQueueRequest { Attributes = attrs, QueueName = "MyTestQueue" }; var response = client.CreateQueue(request); Console.WriteLine("Queue URL: " + response.QueueUrl);
.NET Framework:
Supported in: 4.5, 4.0, 3.5
.NET for Windows Store apps:
Supported in: Windows 8.1, Windows 8
.NET for Windows Phone:
Supported in: Windows Phone 8.1, Windows Phone 8