public class AmazonSQSMessagingClientWrapper
extends java.lang.Object
AmazonSQSClient. This class changes all
AmazonServiceException and AmazonClientException into
JMSException/JMSSecurityException.| Constructor and Description |
|---|
AmazonSQSMessagingClientWrapper(AmazonSQS amazonSQSClient) |
| Modifier and Type | Method and Description |
|---|---|
void |
changeMessageVisibility(ChangeMessageVisibilityRequest changeMessageVisibilityRequest)
Calls
changeMessageVisibility and wraps AmazonClientException. |
ChangeMessageVisibilityBatchResult |
changeMessageVisibilityBatch(ChangeMessageVisibilityBatchRequest changeMessageVisibilityBatchRequest)
Calls
changeMessageVisibilityBatch and wraps AmazonClientException. |
CreateQueueResult |
createQueue(CreateQueueRequest createQueueRequest)
Calls
createQueue to create the queue with the provided queue attributes
if any, and wraps AmazonClientException |
CreateQueueResult |
createQueue(java.lang.String queueName)
Calls
createQueue to create the queue with the default queue attributes,
and wraps AmazonClientException |
void |
deleteMessage(DeleteMessageRequest deleteMessageRequest)
Calls
deleteMessage and wraps AmazonClientException. |
DeleteMessageBatchResult |
deleteMessageBatch(DeleteMessageBatchRequest deleteMessageBatchRequest)
Calls
deleteMessageBatch and wraps
AmazonClientException. |
AmazonSQS |
getAmazonSQSClient()
If one uses any other AWS SDK operations other than explicitly listed
here, the exceptions thrown by those operations will not be wrapped as
JMSException. |
GetQueueUrlResult |
getQueueUrl(GetQueueUrlRequest getQueueUrlRequest)
Calls
getQueueUrl and wraps AmazonClientException |
GetQueueUrlResult |
getQueueUrl(java.lang.String queueName)
Gets the queueUrl of a queue given a queue name.
|
GetQueueUrlResult |
getQueueUrl(java.lang.String queueName,
java.lang.String queueOwnerAccountId)
Gets the queueUrl of a queue given a queue name owned by the provided accountId.
|
boolean |
queueExists(java.lang.String queueName)
Check if the requested queue exists.
|
boolean |
queueExists(java.lang.String queueName,
java.lang.String queueOwnerAccountId)
Check if the requested queue exists.
|
ReceiveMessageResult |
receiveMessage(ReceiveMessageRequest receiveMessageRequest)
Calls
receiveMessage and wraps AmazonClientException. |
SendMessageResult |
sendMessage(SendMessageRequest sendMessageRequest)
Calls
sendMessage and wraps
AmazonClientException. |
void |
setEndpoint(java.lang.String endpoint)
Sets SQS endpoint and wraps IllegalArgumentException.
|
void |
setRegion(Region region)
Sets SQS region and wraps
IllegalArgumentException. |
public AmazonSQSMessagingClientWrapper(AmazonSQS amazonSQSClient) throws JMSException
amazonSQSClient - The AWS SDK Client for SQS.JMSException - if the client is nullpublic AmazonSQS getAmazonSQSClient()
JMSException.public void setEndpoint(java.lang.String endpoint)
throws JMSException
endpoint - The endpoint (ex: "sqs.us-east-1.amazonaws.com") of the region
specific AWS endpoint this client will communicate with.JMSExceptionpublic void setRegion(Region region)
throws JMSException
IllegalArgumentException. This is the recommend
way to set-up the SQS end-points.region - The region this client will communicate with. See
Region#getRegion(com.amazonaws.regions.Regions) for
accessing a given region.JMSExceptionpublic void deleteMessage(DeleteMessageRequest deleteMessageRequest) throws JMSException
deleteMessage and wraps AmazonClientException. This is used to
acknowledge single messages, so that they can be deleted from SQS queue.deleteMessageRequest - Container for the necessary parameters to execute the
deleteMessage service method on AmazonSQS.JMSExceptionpublic DeleteMessageBatchResult deleteMessageBatch(DeleteMessageBatchRequest deleteMessageBatchRequest) throws JMSException
deleteMessageBatch and wraps
AmazonClientException. This is used to acknowledge multiple
messages on client_acknowledge mode, so that they can be deleted from SQS
queue.deleteMessageBatchRequest - Container for the necessary parameters to execute the
deleteMessageBatch service method on AmazonSQS. This is the
batch version of deleteMessage. Max batch size is 10.JMSExceptionpublic SendMessageResult sendMessage(SendMessageRequest sendMessageRequest) throws JMSException
sendMessage and wraps
AmazonClientException.sendMessageRequest - Container for the necessary parameters to execute the
sendMessage service method on AmazonSQS.JMSExceptionpublic boolean queueExists(java.lang.String queueName)
throws JMSException
GetQueueUrl for the given queue name, returning true on
success, false if it gets QueueDoesNotExistException.queueName - the queue to checkJMSExceptionpublic boolean queueExists(java.lang.String queueName,
java.lang.String queueOwnerAccountId)
throws JMSException
GetQueueUrl for the given queue name with the given owner
accountId, returning true on success, false if it gets
QueueDoesNotExistException.queueName - the queue to checkqueueOwnerAccountId - The AWS accountId of the account that created the queueJMSExceptionpublic GetQueueUrlResult getQueueUrl(java.lang.String queueName) throws JMSException
queueName - JMSExceptionpublic GetQueueUrlResult getQueueUrl(java.lang.String queueName, java.lang.String queueOwnerAccountId) throws JMSException
queueName - queueOwnerAccountId - The AWS accountId of the account that created the queueJMSExceptionpublic GetQueueUrlResult getQueueUrl(GetQueueUrlRequest getQueueUrlRequest) throws JMSException
getQueueUrl and wraps AmazonClientExceptiongetQueueUrlRequest - Container for the necessary parameters to execute the
getQueueUrl service method on AmazonSQS.JMSExceptionpublic CreateQueueResult createQueue(java.lang.String queueName) throws JMSException
createQueue to create the queue with the default queue attributes,
and wraps AmazonClientExceptionqueueName - JMSExceptionpublic CreateQueueResult createQueue(CreateQueueRequest createQueueRequest) throws JMSException
createQueue to create the queue with the provided queue attributes
if any, and wraps AmazonClientExceptioncreateQueueRequest - Container for the necessary parameters to execute the
createQueue service method on AmazonSQS.JMSExceptionpublic ReceiveMessageResult receiveMessage(ReceiveMessageRequest receiveMessageRequest) throws JMSException
receiveMessage and wraps AmazonClientException. Used by
SQSMessageConsumerPrefetch to receive up to minimum of
(numberOfMessagesToPrefetch,10) messages from SQS queue into consumer
prefetch buffers.receiveMessageRequest - Container for the necessary parameters to execute the
receiveMessage service method on AmazonSQS.JMSExceptionpublic void changeMessageVisibility(ChangeMessageVisibilityRequest changeMessageVisibilityRequest) throws JMSException
changeMessageVisibility and wraps AmazonClientException. This is
used to for negative acknowledge of a single message, so that messages can be received again without any delay.changeMessageVisibilityRequest - Container for the necessary parameters to execute the
changeMessageVisibility service method on AmazonSQS.JMSExceptionpublic ChangeMessageVisibilityBatchResult changeMessageVisibilityBatch(ChangeMessageVisibilityBatchRequest changeMessageVisibilityBatchRequest) throws JMSException
changeMessageVisibilityBatch and wraps AmazonClientException. This is
used to for negative acknowledge of messages in batch, so that messages
can be received again without any delay.changeMessageVisibilityBatchRequest - Container for the necessary parameters to execute the
changeMessageVisibilityBatch service method on AmazonSQS.JMSException