| Did this page help you? Yes No Tell us about it... |
The first task in using Amazon SQS is to create one or more queues. The following examples demonstrate creation of a queue named MyQueue.
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.
To run the sample
Open SimpleQueueServiceSample.java.
The following section of the code creates a queue:
// Create a queue
System.out.println("Creating a new SQS queue called MyQueue.\n");
CreateQueueRequest createQueueRequest = new CreateQueueRequest().withQueueName("MyQueue");
String myQueueUrl = sqs.createQueue(createQueueRequest).getQueueUrl();Compile and run the sample.
The MyQueue queue is created.
To run the sample
Open Program.cs.
The following section of the code creates a queue:
//Creating a queue
Console.WriteLine("Create a queue called MyQueue.\n");
CreateQueueRequest sqsRequest = new CreateQueueRequest();
sqsRequest.QueueName = "MyQueue";
CreateQueueResponse createQueueResponse = sqs.CreateQueue(sqsRequest);
String myQueueUrl;
myQueueUrl = createQueueResponse.CreateQueueResult.QueueUrl;Run the sample.
The MyQueue queue is created.
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.
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.