com.xerox.amazonws.sqs2
Class QueueService

java.lang.Object
  extended by com.xerox.amazonws.common.AWSConnection
      extended by com.xerox.amazonws.common.AWSQueryConnection
          extended by com.xerox.amazonws.sqs2.QueueService

public class QueueService
extends AWSQueryConnection

This class provides an interface with the Amazon SQS service. It provides high level methods for listing and creating message queues.

Author:
D. Kavanagh, developer@dotech.com

Field Summary
 
Fields inherited from class com.xerox.amazonws.common.AWSConnection
headers
 
Constructor Summary
QueueService(String awsAccessId, String awsSecretKey)
          Initializes the queue service with your AWS login information.
QueueService(String awsAccessId, String awsSecretKey, boolean isSecure)
          Initializes the queue service with your AWS login information.
QueueService(String awsAccessId, String awsSecretKey, boolean isSecure, String server)
          Initializes the queue service with your AWS login information.
QueueService(String awsAccessId, String awsSecretKey, boolean isSecure, String server, int port)
          Initializes the queue service with your AWS login information.
 
Method Summary
 MessageQueue getMessageQueue(String queueName)
          Returns a new message queue.
 MessageQueue getOrCreateMessageQueue(String queueName)
          Creates a new message queue.
 MessageQueue getOrCreateMessageQueue(String queueName, int timeout)
          Creates a new message queue.
 List<MessageQueue> listMessageQueues(String queueNamePrefix)
          Retrieves a list of message queues.
protected
<T> T
makeRequestInt(org.apache.http.client.methods.HttpRequestBase method, String action, Map<String,String> params, Class<T> respType)
           
 
Methods inherited from class com.xerox.amazonws.common.AWSQueryConnection
close, close, getConnectionManagerTimeout, getConnectionTimeout, getHeaders, getHttpClient, getMaxConnections, getMaxRetries, getServerTimeZone, getSoTimeout, getString, httpDate, makeRequest, setConnectionManagerTimeout, setConnectionTimeout, setHttpClient, setMaxConnections, setMaxRetries, setProxyValues, setProxyValues, setProxyValues, setServerTimeZone, setSoTimeout, useSystemProxy
 
Methods inherited from class com.xerox.amazonws.common.AWSConnection
encode, encode, getAlgorithm, getAwsAccessKeyId, getPort, getResourcePrefix, getSecretAccessKey, getServer, getSignatureVersion, getUrl, isSecure, makeURL, setResourcePrefix, setServer, setSignatureVersion, urlencode
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

QueueService

public QueueService(String awsAccessId,
                    String awsSecretKey)
Initializes the queue service with your AWS login information.

Parameters:
awsAccessId - The your user key into AWS
awsSecretKey - The secret string used to generate signatures for authentication.

QueueService

public QueueService(String awsAccessId,
                    String awsSecretKey,
                    boolean isSecure)
Initializes the queue service with your AWS login information.

Parameters:
awsAccessId - The your user key into AWS
awsSecretKey - The secret string used to generate signatures for authentication.
isSecure - True if the data should be encrypted on the wire on the way to or from SQS.

QueueService

public QueueService(String awsAccessId,
                    String awsSecretKey,
                    boolean isSecure,
                    String server)
Initializes the queue service with your AWS login information.

Parameters:
awsAccessId - The your user key into AWS
awsSecretKey - The secret string used to generate signatures for authentication.
isSecure - True if the data should be encrypted on the wire on the way to or from SQS.
server - Which host to connect to. Usually, this will be queue.amazonaws.com

QueueService

public QueueService(String awsAccessId,
                    String awsSecretKey,
                    boolean isSecure,
                    String server,
                    int port)
Initializes the queue service with your AWS login information.

Parameters:
awsAccessId - The your user key into AWS
awsSecretKey - The secret string used to generate signatures for authentication.
isSecure - True if the data should be encrypted on the wire on the way to or from SQS.
server - Which host to connect to. Usually, this will be queue.amazonaws.com
port - Which port to use.
Method Detail

getOrCreateMessageQueue

public MessageQueue getOrCreateMessageQueue(String queueName)
                                     throws SQSException
Creates a new message queue. The queue name must be unique within the scope of the queues you own. Optionaly, you can supply a queue that might be one that belongs to another user that has granted you access to the queue. In that case, supply the fully qualified queue name (i.e. "/A98KKI3K0RJ7Q/grantedQueue").

Parameters:
queueName - name of queue to be created
Returns:
object representing the message queue
Throws:
SQSException

getOrCreateMessageQueue

public MessageQueue getOrCreateMessageQueue(String queueName,
                                            int timeout)
                                     throws SQSException
Creates a new message queue. The queue name must be unique within the scope of the queues you own. Optionaly, you can supply a queue that might be one that belongs to another user that has granted you access to the queue. In that case, supply the fully qualified queue name (i.e. "/A98KKI3K0RJ7Q/grantedQueue").

Parameters:
queueName - name of queue to be created
timeout - the duration (in seconds) the retrieved message is hidden from subsequent calls to retrieve.
Returns:
object representing the message queue
Throws:
SQSException

getMessageQueue

public MessageQueue getMessageQueue(String queueName)
                             throws SQSException
Returns a new message queue. The queue name must be of a queue already created and/or accessible to your account. (i.e. "https://queue.amazonaws.com/A98KKI3K0RJ7Q/myQueue", "/B38IZ53W0RU2X/grantedQueue").

Parameters:
queueName - qualified name of queue
Returns:
object representing the message queue
Throws:
SQSException

listMessageQueues

public List<MessageQueue> listMessageQueues(String queueNamePrefix)
                                     throws SQSException
Retrieves a list of message queues. A maximum of 1,000 queue URLs are returned. If a value is specified for the optional queueNamePrefix parameter, only those queues with a queue name beginning with the value specified are returned. The queue name is specified in the QueueName parameter when a queue is created.

Parameters:
queueNamePrefix - the optional prefix for filtering results. can be null.
Returns:
a list of objects representing the message queues defined for this account
Throws:
SQSException

makeRequestInt

protected <T> T makeRequestInt(org.apache.http.client.methods.HttpRequestBase method,
                               String action,
                               Map<String,String> params,
                               Class<T> respType)
                    throws SQSException
Throws:
SQSException