org.jclouds.sqs.features
Interface QueueApi


public interface QueueApi

Provides access to SQS via their REST API.

Author:
Adrian Cole
See Also:
QueueAsyncApi

Method Summary
 URI create(String queueName)
          The CreateQueue action creates a new queue.
 URI create(String queueName, CreateQueueOptions options)
          same as #create(String, String) except you can control options such as delay seconds.
 void delete(URI queue)
          The DeleteQueue action deletes the queue specified by the queue URL, regardless of whether the queue is empty.
 URI get(String queueName)
          The GetQueueUrl action returns the Uniform Resource Locater (URL) of a queue.
 String getAttribute(URI queue, String attributeName)
          returns an attribute of a queue.
 QueueAttributes getAttributes(URI queue)
          returns all attributes of a queue.
 Map<String,String> getAttributes(URI queue, Iterable<String> attributeNames)
          returns some attributes of a queue.
 URI getInAccount(String queueName, String accountId)
          like get(String), except specifying the owner of the queue.
 com.google.common.collect.FluentIterable<URI> list()
          The ListQueues action returns a list of your queues.
 com.google.common.collect.FluentIterable<URI> list(ListQueuesOptions options)
           
 void setAttribute(URI queue, String name, String value)
          The SetQueueAttributes action sets one attribute of a queue per request.
 

Method Detail

list

com.google.common.collect.FluentIterable<URI> list()
The ListQueues action returns a list of your queues. The maximum number of queues that can be returned is 1000. If you specify a value for the optional QueueNamePrefix parameter, only queues with a name beginning with the specified value are returned

Parameters:
region - Queues are Region-specific.
options - specify prefix or other options
See Also:

list

com.google.common.collect.FluentIterable<URI> list(ListQueuesOptions options)

get

URI get(String queueName)
The GetQueueUrl action returns the Uniform Resource Locater (URL) of a queue. This action provides a simple way to retrieve the URL of an SQS queue.

Parameters:
queueName - The name of an existing queue.
Returns:
uri of the queue or null if not found

getInAccount

URI getInAccount(String queueName,
                 String accountId)
like get(String), except specifying the owner of the queue. To access a queue that belongs to another AWS account, use the QueueOwnerAWSAccountId parameter to specify the account ID of the queue's owner. The queue's owner must grant you permission to access the queue.

Parameters:
accountId -
Returns:
The AWS account ID of the account that created the queue.

create

URI create(String queueName)
The CreateQueue action creates a new queue. 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.

Note

If you delete a queue, you must wait at least 60 seconds before creating a queue with the same name. 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.

Tip

Use GetQueueUrl to get a queue's URL. GetQueueUrl requires only the QueueName parameter.

Parameters:
region - Queues are Region-specific.
queueName - The name to use for the queue created. Constraints: Maximum 80 characters; alphanumeric characters, hyphens (-), and underscores (_) are allowed.

create

URI create(String queueName,
           CreateQueueOptions options)
same as #create(String, String) except you can control options such as delay seconds.

Parameters:
options - options such as delay seconds
See Also:
#create(String, String)

delete

void delete(URI queue)
The DeleteQueue action deletes the queue specified by the queue URL, regardless of whether the queue is empty. If the specified queue does not exist, SQS returns a successful response.

Caution

Use DeleteQueue with care; once you delete your queue, any messages in the queue are no longer available. When you delete a queue, the deletion process takes up to 60 seconds. Requests you send involving that queue during the 60 seconds might succeed. For example, a SendMessage request might succeed, but after the 60 seconds, the queue and that message you sent no longer exist. Also, when you delete a queue, you must wait at least 60 seconds before creating a queue with the same name. We reserve the right to delete queues that have had no activity for more than 30 days. For more information, see About SQS Queues in the Amazon SQS Developer Guide.

Parameters:
queue - queue you want to delete

getAttributes

QueueAttributes getAttributes(URI queue)
returns all attributes of a queue.

Parameters:
queue - queue to get the attributes of

setAttribute

void setAttribute(URI queue,
                  String name,
                  String value)
The SetQueueAttributes action sets one attribute of a queue per request. When you change a queue's attributes, the change can take up to 60 seconds to propagate throughout the SQS system.

Parameters:
queue - queue to set the attribute on
name - The name of the attribute you want to set. VisibilityTimeout - The length of time (in seconds) that a message received from a queue will be invisible to other receiving components when they ask to receive messages. For more information about VisibilityTimeout, see Visibility Timeout in the Amazon SQS Developer Guide. Policy - The formal description of the permissions for a resource. For more information about Policy, see Basic Policy Structure in the Amazon SQS Developer Guide. MaximumMessageSize - The limit of how many bytes a message can contain before Amazon SQS rejects it. MessageRetentionPeriod - The number of seconds Amazon SQS retains a message. DelaySeconds - The time in seconds that the delivery of all messages in the queue will be delayed.
value - The value of the attribute you want to set. To delete a queue's access control policy, set the policy to "". Constraints: Constraints are specific for each value. VisibilityTimeout - An integer from 0 to 43200 (12 hours). The default for this attribute is 30 seconds. Policy - A valid form-url-encoded policy. For more information about policy structure, see Basic Policy Structure in the Amazon SQS Developer Guide. For more information about form-url-encoding, see http://www.w3.org/MarkUp/html-spec/html-spec_8.html#SEC8.2.1. MaximumMessageSize - An integer from 1024 bytes (1 KiB) up to 65536 bytes (64 KiB). The default for this attribute is 65536 (64 KiB). MessageRetentionPeriod - Integer representing seconds, from 60 (1 minute) to 1209600 (14 days). The default for this attribute is 345600 (4 days). DelaySeconds - An integer from 0 to 900 (15 minutes). The default for this attribute is 0.

getAttributes

Map<String,String> getAttributes(URI queue,
                                 Iterable<String> attributeNames)
returns some attributes of a queue.

Parameters:
queue - queue to get the attributes of

getAttribute

String getAttribute(URI queue,
                    String attributeName)
returns an attribute of a queue.

Parameters:
queue - queue to get the attributes of


Copyright © 2009-2013 jclouds. All Rights Reserved.