Package com.amazon.sqs.javamessaging
Class AmazonSQSMessagingClientWrapper
- java.lang.Object
-
- com.amazon.sqs.javamessaging.AmazonSQSMessagingClientWrapper
-
public class AmazonSQSMessagingClientWrapper extends Object
This is a JMS Wrapper ofSqsClient. This class changes allAwsServiceExceptionandSdkExceptioninto JMSException/JMSSecurityException.
-
-
Constructor Summary
Constructors Constructor Description AmazonSQSMessagingClientWrapper(software.amazon.awssdk.services.sqs.SqsClient amazonSQSClient)AmazonSQSMessagingClientWrapper(software.amazon.awssdk.services.sqs.SqsClient amazonSQSClient, software.amazon.awssdk.auth.credentials.AwsCredentialsProvider credentialsProvider)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidchangeMessageVisibility(software.amazon.awssdk.services.sqs.model.ChangeMessageVisibilityRequest changeMessageVisibilityRequest)CallschangeMessageVisibilityand wrapsSdkException.software.amazon.awssdk.services.sqs.model.ChangeMessageVisibilityBatchResponsechangeMessageVisibilityBatch(software.amazon.awssdk.services.sqs.model.ChangeMessageVisibilityBatchRequest changeMessageVisibilityBatchRequest)CallschangeMessageVisibilityBatchand wrapsSdkException.software.amazon.awssdk.services.sqs.model.CreateQueueResponsecreateQueue(String queueName)CallscreateQueueto create the queue with the default queue attributes, and wrapsSdkExceptionsoftware.amazon.awssdk.services.sqs.model.CreateQueueResponsecreateQueue(software.amazon.awssdk.services.sqs.model.CreateQueueRequest createQueueRequest)CallscreateQueueto create the queue with the provided queue attributes if any, and wrapsSdkExceptionvoiddeleteMessage(software.amazon.awssdk.services.sqs.model.DeleteMessageRequest deleteMessageRequest)CallsdeleteMessageand wrapsSdkException.software.amazon.awssdk.services.sqs.model.DeleteMessageBatchResponsedeleteMessageBatch(software.amazon.awssdk.services.sqs.model.DeleteMessageBatchRequest deleteMessageBatchRequest)CallsdeleteMessageBatchand wrapsSdkException.software.amazon.awssdk.services.sqs.SqsClientgetAmazonSQSClient()If one uses any other AWS SDK operations other than explicitly listed here, the exceptions thrown by those operations will not be wrapped asJMSException.software.amazon.awssdk.services.sqs.model.GetQueueUrlResponsegetQueueUrl(String queueName)Gets the queueUrl of a queue given a queue name.software.amazon.awssdk.services.sqs.model.GetQueueUrlResponsegetQueueUrl(String queueName, String queueOwnerAccountId)Gets the queueUrl of a queue given a queue name owned by the provided accountId.software.amazon.awssdk.services.sqs.model.GetQueueUrlResponsegetQueueUrl(software.amazon.awssdk.services.sqs.model.GetQueueUrlRequest getQueueUrlRequest)CallsgetQueueUrland wrapsSdkExceptionbooleanqueueExists(String queueName)Check if the requested queue exists.booleanqueueExists(String queueName, String queueOwnerAccountId)Check if the requested queue exists.software.amazon.awssdk.services.sqs.model.ReceiveMessageResponsereceiveMessage(software.amazon.awssdk.services.sqs.model.ReceiveMessageRequest receiveMessageRequest)CallsreceiveMessageand wrapsSdkException.software.amazon.awssdk.services.sqs.model.SendMessageResponsesendMessage(software.amazon.awssdk.services.sqs.model.SendMessageRequest sendMessageRequest)CallssendMessageand wrapsAmazonClientException.
-
-
-
Constructor Detail
-
AmazonSQSMessagingClientWrapper
public AmazonSQSMessagingClientWrapper(software.amazon.awssdk.services.sqs.SqsClient amazonSQSClient) throws javax.jms.JMSException- Parameters:
amazonSQSClient- The AWS SDK Client for SQS.- Throws:
javax.jms.JMSException- if the client is null
-
AmazonSQSMessagingClientWrapper
public AmazonSQSMessagingClientWrapper(software.amazon.awssdk.services.sqs.SqsClient amazonSQSClient, software.amazon.awssdk.auth.credentials.AwsCredentialsProvider credentialsProvider) throws javax.jms.JMSException- Parameters:
amazonSQSClient- The AWS SDK Client for SQS.- Throws:
javax.jms.JMSException- if the client is null
-
-
Method Detail
-
getAmazonSQSClient
public software.amazon.awssdk.services.sqs.SqsClient getAmazonSQSClient()
If one uses any other AWS SDK operations other than explicitly listed here, the exceptions thrown by those operations will not be wrapped asJMSException.- Returns:
- amazonSQSClient
-
deleteMessage
public void deleteMessage(software.amazon.awssdk.services.sqs.model.DeleteMessageRequest deleteMessageRequest) throws javax.jms.JMSExceptionCallsdeleteMessageand wrapsSdkException. This is used to acknowledge single messages, so that they can be deleted from SQS queue.- Parameters:
deleteMessageRequest- Container for the necessary parameters to execute the deleteMessage service method on SqsClient.- Throws:
javax.jms.JMSException
-
deleteMessageBatch
public software.amazon.awssdk.services.sqs.model.DeleteMessageBatchResponse deleteMessageBatch(software.amazon.awssdk.services.sqs.model.DeleteMessageBatchRequest deleteMessageBatchRequest) throws javax.jms.JMSExceptionCallsdeleteMessageBatchand wrapsSdkException. This is used to acknowledge multiple messages on client_acknowledge mode, so that they can be deleted from SQS queue.- Parameters:
deleteMessageBatchRequest- Container for the necessary parameters to execute the deleteMessageBatch service method on SqsClient. This is the batch version of deleteMessage. Max batch size is 10.- Returns:
- The response from the deleteMessageBatch service method, as returned by SqsClient
- Throws:
javax.jms.JMSException
-
sendMessage
public software.amazon.awssdk.services.sqs.model.SendMessageResponse sendMessage(software.amazon.awssdk.services.sqs.model.SendMessageRequest sendMessageRequest) throws javax.jms.JMSExceptionCallssendMessageand wrapsAmazonClientException.- Parameters:
sendMessageRequest- Container for the necessary parameters to execute the sendMessage service method on SqsClient.- Returns:
- The response from the sendMessage service method, as returned by SqsClient
- Throws:
javax.jms.JMSException
-
queueExists
public boolean queueExists(String queueName) throws javax.jms.JMSException
Check if the requested queue exists. This function callsGetQueueUrlfor the given queue name, returning true on success, false if it getsQueueDoesNotExistException.- Parameters:
queueName- the queue to check- Returns:
- true if the queue exists, false if it doesn't.
- Throws:
javax.jms.JMSException
-
queueExists
public boolean queueExists(String queueName, String queueOwnerAccountId) throws javax.jms.JMSException
Check if the requested queue exists. This function callsGetQueueUrlfor the given queue name with the given owner accountId, returning true on success, false if it getsQueueDoesNotExistException.- Parameters:
queueName- the queue to checkqueueOwnerAccountId- The AWS accountId of the account that created the queue- Returns:
- true if the queue exists, false if it doesn't.
- Throws:
javax.jms.JMSException
-
getQueueUrl
public software.amazon.awssdk.services.sqs.model.GetQueueUrlResponse getQueueUrl(String queueName) throws javax.jms.JMSException
Gets the queueUrl of a queue given a queue name.- Parameters:
queueName-- Returns:
- The response from the GetQueueUrl service method, as returned by SqsClient, which will include queue`s URL
- Throws:
javax.jms.JMSException
-
getQueueUrl
public software.amazon.awssdk.services.sqs.model.GetQueueUrlResponse getQueueUrl(String queueName, String queueOwnerAccountId) throws javax.jms.JMSException
Gets the queueUrl of a queue given a queue name owned by the provided accountId.- Parameters:
queueName-queueOwnerAccountId- The AWS accountId of the account that created the queue- Returns:
- The response from the GetQueueUrl service method, as returned by SqsClient, which will include queue`s URL
- Throws:
javax.jms.JMSException
-
getQueueUrl
public software.amazon.awssdk.services.sqs.model.GetQueueUrlResponse getQueueUrl(software.amazon.awssdk.services.sqs.model.GetQueueUrlRequest getQueueUrlRequest) throws javax.jms.JMSExceptionCallsgetQueueUrland wrapsSdkException- Parameters:
getQueueUrlRequest- Container for the necessary parameters to execute the getQueueUrl service method on SqsClient.- Returns:
- The response from the GetQueueUrl service method, as returned by SqsClient, which will include queue`s URL
- Throws:
javax.jms.JMSException
-
createQueue
public software.amazon.awssdk.services.sqs.model.CreateQueueResponse createQueue(String queueName) throws javax.jms.JMSException
CallscreateQueueto create the queue with the default queue attributes, and wrapsSdkException- Parameters:
queueName-- Returns:
- The response from the createQueue service method, as returned by SqsClient. This call creates a new queue, or returns the URL of an existing one.
- Throws:
javax.jms.JMSException
-
createQueue
public software.amazon.awssdk.services.sqs.model.CreateQueueResponse createQueue(software.amazon.awssdk.services.sqs.model.CreateQueueRequest createQueueRequest) throws javax.jms.JMSExceptionCallscreateQueueto create the queue with the provided queue attributes if any, and wrapsSdkException- Parameters:
createQueueRequest- Container for the necessary parameters to execute the createQueue service method on SqsClient.- Returns:
- The response from the createQueue service method, as returned by SqsClient. This call creates a new queue, or returns the URL of an existing one.
- Throws:
javax.jms.JMSException
-
receiveMessage
public software.amazon.awssdk.services.sqs.model.ReceiveMessageResponse receiveMessage(software.amazon.awssdk.services.sqs.model.ReceiveMessageRequest receiveMessageRequest) throws javax.jms.JMSExceptionCallsreceiveMessageand wrapsSdkException. Used bySQSMessageConsumerPrefetchto receive up to minimum of (numberOfMessagesToPrefetch,10) messages from SQS queue into consumer prefetch buffers.- Parameters:
receiveMessageRequest- Container for the necessary parameters to execute the receiveMessage service method on SqsClient.- Returns:
- The response from the ReceiveMessage service method, as returned by SqsClient.
- Throws:
javax.jms.JMSException
-
changeMessageVisibility
public void changeMessageVisibility(software.amazon.awssdk.services.sqs.model.ChangeMessageVisibilityRequest changeMessageVisibilityRequest) throws javax.jms.JMSExceptionCallschangeMessageVisibilityand wrapsSdkException. This is used to for negative acknowledge of a single message, so that messages can be received again without any delay.- Parameters:
changeMessageVisibilityRequest- Container for the necessary parameters to execute the changeMessageVisibility service method on SqsClient.- Throws:
javax.jms.JMSException
-
changeMessageVisibilityBatch
public software.amazon.awssdk.services.sqs.model.ChangeMessageVisibilityBatchResponse changeMessageVisibilityBatch(software.amazon.awssdk.services.sqs.model.ChangeMessageVisibilityBatchRequest changeMessageVisibilityBatchRequest) throws javax.jms.JMSExceptionCallschangeMessageVisibilityBatchand wrapsSdkException. This is used to for negative acknowledge of messages in batch, so that messages can be received again without any delay.- Parameters:
changeMessageVisibilityBatchRequest- Container for the necessary parameters to execute the changeMessageVisibilityBatch service method on SqsClient.- Returns:
- The response from the changeMessageVisibilityBatch service method, as returned by SqsClient.
- Throws:
javax.jms.JMSException
-
-