Amazon Simple Queue Service
Getting Started Guide (API Version 2011-10-01)
Print this pageEmail this pageGo to the ForumsView the PDFShare this page on TwitterShare this page on FacebookBookmark this page on DeliciousSubmit this page to RedditSubmit this page to DiggDid this page help you?  Yes  No   Tell us about it...

Confirming the Queue Exists

When you create a queue, it can take a short time for the queue to propagate throughout the SQS system. You can confirm the queue's existence by listing the queues you have in SQS. The following code snippets list the queues you've created using the 2009-02-01 version of SQS.

AWS Management Console

The AWS Management Console displays a list of your queues for the region you have selected. By default, the console displays the US East region.

To display a queue list for a specific region

  • Select a region from the Region drop-down list.

    The console displays all of your queues in that region.

    AWS Management Console queue list

Scratchpad

To run the sample

  1. In the scratchpad, select ListQueues from the Explore API list box.

  2. Leave the Queue Name Prefix field blank.

  3. 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.

Java

To run the sample

  1. Open SimpleQueueServiceSample.java.

    The following section of the code lists your queues:

    // List queues
    System.out.println("Listing all queues in your account.\n");
    for (String queueUrl : sqs.listQueues().getQueueUrls()) {
        System.out.println("  QueueUrl: " + queueUrl);
    }
    System.out.println();
  2. Compile and run the sample.

    Amazon SQS returns the list of the queues you've created using the 2009-02-01 version of Amazon SQS, including the newly created MyQueue queue. Each queue is identified by its queue URL. The response also includes the request ID Amazon SQS assigned to your request.

C#

To run the sample

  1. Open Program.cs.

    The following section of the code lists your queues:

    //Confirming the queue exists
    ListQueuesRequest listQueuesRequest = new ListQueuesRequest();
    ListQueuesResponse listQueuesResponse = sqs.ListQueues(listQueuesRequest);
    
    Console.WriteLine("Printing list of Amazon SQS queues.\n");
    if (listQueuesResponse.IsSetListQueuesResult())
    {
        ListQueuesResult listQueuesResult = listQueuesResponse.ListQueuesResult;
        foreach (String queueUrl in listQueuesResult.QueueUrl)
        {
    	Console.WriteLine("  QueueUrl: {0}", queueUrl);
        }
    }
    Console.WriteLine();
  2. Run the sample.

    Amazon SQS returns the list of the queues you've created using the 2009-02-01 version of Amazon SQS, including the newly created MyQueue queue. Each queue is identified by its queue URL. The response also includes the request ID Amazon SQS assigned to your request.

Perl

To run the sample

  1. Open ListQueuesSample.pl.

  2. Locate the following line.

    # invokeListQueues($service, $request);
  3. Replace the line with the following new lines of code.

    my $request = Amazon::SQS::Model::ListQueuesRequest->new();
    invokeListQueues($service, $request);
  4. Run the sample.

    Amazon SQS returns the list of the queues you've created using the 2009-02-01 version of Amazon SQS, including the newly created MyQueue queue. Each queue is identified by its queue URL. The response also includes the request ID Amazon SQS assigned to your request.

PHP5

To run the sample

  1. Open ListQueuesSample.php.

  2. Locate the following line.

    // invokeListQueues($service, $request);
  3. Replace the line with the following new lines of code.

    require_once ('Amazon/SQS/Model/ListQueuesRequest.php');
    $request = new Amazon_SQS_Model_ListQueuesRequest();
    invokeListQueues($service, $request);
    
  4. Run the sample.

    Amazon SQS returns the list of the queues you've created using the 2009-02-01 version of Amazon SQS, including the newly created MyQueue queue. Each queue is identified by its queue URL. The response also includes the request ID Amazon SQS assigned to your request.