The first step in using Amazon SQS is to create one or more queues. The following sample code
snippets demonstrate creation of a queue named MyQueue.
To run the sample
Open CreateQueueSample.java.
Locate the following lines.
CreateQueueRequest request = new CreateQueueRequest(); // @TODO: set request parameters here // invokeCreateQueue(service, request);
Replace the lines with the following new lines of code.
CreateQueueRequest request = new CreateQueueRequest();
request.setQueueName("MyQueue");
invokeCreateQueue(service, request);Compile and run the sample.
The MyQueue queue is created. The sample prints the queue URL for the queue and the request ID that Amazon SQS assigned to your request.
![]() | Note |
|---|---|
When you design your own application, we recommend you include a check for the |
To run the sample
Open AmazonSQSSamples.cs.
Locate the following lines.
// CreateQueueRequest request = new CreateQueueRequest(); // @TODO: set request parameters here // CreateQueueSample.InvokeCreateQueue(service, request);
Replace the lines with the following new lines of code.
CreateQueueRequest request = new CreateQueueRequest(); request.QueueName = "MyQueue"; CreateQueueSample.InvokeCreateQueue(service, request);
Run the sample.
The MyQueue queue is created. The sample prints the queue URL for the queue and the request ID that Amazon SQS assigned to your request.
![]() | Note |
|---|---|
When you design your own application, we recommend you include a check for the |
To run the sample
Open CreateQueueSample.pl.
Locate the following line.
# invokeCreateQueue($service, $request);
Replace the line with the following new lines of code.
my $request = Amazon::SQS::Model::CreateQueueRequest->new({
QueueName => "MyQueue"
});
invokeCreateQueue($service, $request);Run the sample.
The MyQueue queue is created. The sample prints the queue URL for the queue and the request ID that Amazon SQS assigned to your request.
![]() | Note |
|---|---|
When you design your own application, we recommend you include a check for the |
To run the sample
Open CreateQueueSample.php.
Locate the following line.
// invokeCreateQueue($service, $request);
Replace the line with the following new lines of code.
require_once ('Amazon/SQS/Model/CreateQueueRequest.php');
$request = new Amazon_SQS_Model_CreateQueueRequest();
$request->setQueueName('MyQueue');
invokeCreateQueue($service, $request);Run the sample.
The MyQueue queue is created. The sample prints the queue URL for the queue and the request ID that Amazon SQS assigned to your request.
![]() | Note |
|---|---|
When you design your own application, we recommend you include a check for the |
To run the sample
Open AmazonSQSSamples.vb.
Locate the following lines.
' Dim request As New CreateQueueRequest() ' @TODO: set request parameters here ' CreateQueueSample.InvokeCreateQueue(service, request)
Replace the lines with the following new lines of code.
Dim request As New CreateQueueRequest() request.QueueName = "MyQueue" CreateQueueSample.InvokeCreateQueue(service, request)
Run the sample.
The MyQueue queue is created. The sample prints the queue URL for the queue and the request ID that Amazon SQS assigned to your request.
![]() | Note |
|---|---|
When you design your own application, we recommend you include a check for the |
To run the sample
In the scratchpad, select CreateQueue from the Explore API list box.
Enter MyQueue in the Queue Name field, and leave the
Default Visibility Timeout field blank.
Select one of the following:
To invoke the request, click Invoke Request. Amazon SQS returns a response.
To view the signed URL, click Display Signed URL. Then, copy and paste the signed URL into a browser. Amazon SQS returns a response.
To view the string to sign, click Display String to Sign.