The CreateQueue
action creates a new queue, or returns the URL of an existing one.
When you request 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.
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
.
If you provide the name of an existing queue, a new queue isn’t created. If the values of
attributes provided with the request match up with those on the existing queue, the queue URL
is returned. Otherwise, a QueueNameExists
error is returned.
Access
public
Parameters
Parameter |
Type |
Required |
Description |
---|---|---|---|
|
Required |
The name for the queue to be created. |
|
|
Optional |
An associative array of parameters that can have the following keys:
|
Returns
Type |
Description |
---|---|
A |
Examples
Create a new queue in the (default) US-East region.
// Create a queue $sqs = new AmazonSQS(); $response = $sqs->create_queue('example-queue'); // Success? var_dump($response->isOK());Result:
bool(true)
Create a new queue in the EU-West region.
// Create a queue $sqs = new AmazonSQS(); $sqs->set_region(AmazonSQS::REGION_EU_W1); $response = $sqs->create_queue('example-queue'); // Success? var_dump($response->isOK());Result:
bool(true)
Related Methods
Source
Method defined in services/sqs.class.php | Toggle source view (16 lines) | View on GitHub