|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.xerox.amazonws.common.AWSConnection
com.xerox.amazonws.common.AWSQueryConnection
com.xerox.amazonws.sqs2.MessageQueue
public class MessageQueue
This class provides an interface with the Amazon SQS message queue. It provides methods for sending / receiving messages and deleting queues and messsages on queues.
| Field Summary | |
|---|---|
static int |
MAX_MESSAGES
|
protected String |
queueId
|
| Fields inherited from class com.xerox.amazonws.common.AWSConnection |
|---|
headers |
| Constructor Summary | |
|---|---|
protected |
MessageQueue(String queueUrl,
String awsAccessId,
String awsSecretKey,
boolean isSecure,
int port,
String server)
|
| Method Summary | ||
|---|---|---|
void |
addPermission(String label,
String accountId,
String action)
Adds a permission to this message queue. |
|
static List<MessageQueue> |
createList(String[] queueUrls,
String awsAccessId,
String awsSecretKey,
boolean isSecure,
int port,
String server,
org.apache.http.client.HttpClient hc)
|
|
void |
deleteMessage(Message msg)
Deletes the message identified by message object on the queue this object represents. |
|
void |
deleteMessage(String receiptHandle)
Deletes the message identified by receiptHandle on the queue this object represents. |
|
void |
deleteQueue()
Deletes the message queue represented by this object. |
|
int |
getApproximateNumberOfMessages()
Gets the visibility timeout for the queue. |
|
Map<String,String> |
getQueueAttributes(QueueAttribute qAttr)
Gets queue attributes. |
|
URL |
getUrl()
This method provides the URL for the message queue represented by this object. |
|
int |
getVisibilityTimeout()
Gets the visibility timeout for the queue. |
|
boolean |
isEncoding()
This method returns the state of the base64 encoding flag. |
|
protected
|
makeRequestInt(org.apache.http.client.methods.HttpRequestBase method,
String action,
Map<String,String> params,
Class<T> respType)
|
|
protected URL |
makeURL(String resource)
Overriding this because the queue name is baked into the URL and QUERY assembles the URL within the baseclass. |
|
Message |
receiveMessage()
Attempts to receive a message from the queue. |
|
Message |
receiveMessage(int visibilityTimeout)
Attempts to receive a message from the queue. |
|
protected Message[] |
receiveMessages(BigInteger numMessages,
BigInteger visibilityTimeout,
List<String> attributes)
Internal implementation of receiveMessages. |
|
Message[] |
receiveMessages(int numMessages)
Attempts to retrieve a number of messages from the queue. |
|
Message[] |
receiveMessages(int numMessages,
int visibilityTimeout)
Attempts to retrieve a number of messages from the queue. |
|
Message[] |
receiveMessages(int numMessages,
int visibilityTimeout,
List<String> attributes)
Attempts to retrieve a number of messages from the queue. |
|
void |
removePermission(String label)
Removes a permission from this message queue. |
|
String |
sendMessage(String msg)
Sends a message to a specified queue. |
|
void |
setEncoding(boolean enable)
This method sets the state of the encoding flag. |
|
void |
setMessageVisibilityTimeout(Message msg,
int timeout)
Sets the message visibility timeout. |
|
void |
setMessageVisibilityTimeout(String receiptHandle,
int timeout)
Sets the message visibility timeout. |
|
void |
setQueueAttribute(String attribute,
String value)
Sets a queue attribute. |
|
void |
setVisibilityTimeout(int timeout)
Sets the visibility timeout of the queue. |
|
| 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, isSecure, setResourcePrefix, setServer, setSignatureVersion, urlencode |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final int MAX_MESSAGES
protected String queueId
| Constructor Detail |
|---|
protected MessageQueue(String queueUrl,
String awsAccessId,
String awsSecretKey,
boolean isSecure,
int port,
String server)
throws SQSException
SQSException| Method Detail |
|---|
public URL getUrl()
getUrl in class AWSConnectionpublic boolean isEncoding()
public void setEncoding(boolean enable)
enable - the new state of the encoding flag
public String sendMessage(String msg)
throws SQSException
msg - the message to be sent
SQSException - wraps checked exceptions
public Message receiveMessage()
throws SQSException
SQSException - wraps checked exceptions
public Message receiveMessage(int visibilityTimeout)
throws SQSException
visibilityTimeout - the duration (in seconds) the retrieved message is hidden from
subsequent calls to retrieve.
SQSException - wraps checked exceptions
public Message[] receiveMessages(int numMessages)
throws SQSException
numMessages - the maximum number of messages to return
SQSException - wraps checked exceptions
public Message[] receiveMessages(int numMessages,
int visibilityTimeout)
throws SQSException
numMessages - the maximum number of messages to returnvisibilityTimeout - the duration (in seconds) the retrieved message is hidden from
subsequent calls to retrieve.
SQSException - wraps checked exceptions
public Message[] receiveMessages(int numMessages,
int visibilityTimeout,
List<String> attributes)
throws SQSException
numMessages - the maximum number of messages to returnvisibilityTimeout - the duration (in seconds) the retrieved message is hidden from
subsequent calls to retrieve.attributes - the attributes you'd like to get (SenderId, SentTimestamp, All, ApproximateReceiveCount, ApproximateFirstReceiveTimestamp)
SQSException - wraps checked exceptions
protected Message[] receiveMessages(BigInteger numMessages,
BigInteger visibilityTimeout,
List<String> attributes)
throws SQSException
numMessages - the maximum number of messages to returnvisibilityTimeout - the duration (in seconds) the retrieved message is hidden from
subsequent calls to retrieve.attributes - the attributes you'd like to get (SenderId, SentTimestamp)
SQSException - wraps checked exceptions
public void deleteMessage(Message msg)
throws SQSException
msg - the message to be deleted
SQSException - wraps checked exceptions
public void deleteMessage(String receiptHandle)
throws SQSException
receiptHandle - the handle of the message to be deleted
SQSException - wraps checked exceptions
public void deleteQueue()
throws SQSException
SQSException - wraps checked exceptions
public void setMessageVisibilityTimeout(Message msg,
int timeout)
throws SQSException
msg - the messagetimeout - the duration (in seconds) the retrieved message is hidden from
subsequent calls to retrieve.
SQSException - wraps checked exceptions
public void setMessageVisibilityTimeout(String receiptHandle,
int timeout)
throws SQSException
receiptHandle - the handle of the message to be deletedtimeout - the duration (in seconds) the retrieved message is hidden from
subsequent calls to retrieve.
SQSException - wraps checked exceptions
public int getVisibilityTimeout()
throws SQSException
getQueueAttributes(QueueAttribute).
SQSException - wraps checked exceptions
public int getApproximateNumberOfMessages()
throws SQSException
getQueueAttributes(QueueAttribute).
SQSException - wraps checked exceptions
public Map<String,String> getQueueAttributes(QueueAttribute qAttr)
throws SQSException
SQSException - wraps checked exceptions
public void setVisibilityTimeout(int timeout)
throws SQSException
setQueueAttribute(String, String).
timeout - the duration (in seconds) the retrieved message is hidden from
subsequent calls to retrieve.
SQSException - wraps checked exceptions
public void setQueueAttribute(String attribute,
String value)
throws SQSException
attribute - name of the attribute being setvalue - the value being set for this attribute
SQSException - wraps checked exceptions
public void addPermission(String label,
String accountId,
String action)
throws SQSException
label - a name for this permissionaccountId - the AWS account ID for the account to share this queue withaction - a value to indicate how much to share (SendMessage, ReceiveMessage, ChangeMessageVisibility, DeleteMessage, GetQueueAttributes)
SQSException - wraps checked exceptions
public void removePermission(String label)
throws SQSException
label - a name for the permission to be removed
SQSException - wraps checked exceptions
protected URL makeURL(String resource)
throws MalformedURLException
makeURL in class AWSConnectionresource - The resource name (bucketName + "/" + key).
SQSException - wraps checked exceptions
MalformedURLException
protected <T> T makeRequestInt(org.apache.http.client.methods.HttpRequestBase method,
String action,
Map<String,String> params,
Class<T> respType)
throws SQSException
SQSException
public static List<MessageQueue> createList(String[] queueUrls,
String awsAccessId,
String awsSecretKey,
boolean isSecure,
int port,
String server,
org.apache.http.client.HttpClient hc)
throws SQSException
SQSException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||