Package com.amazon.sqs.javamessaging
Class AmazonSQSMessagingClientWrapper
java.lang.Object
com.amazon.sqs.javamessaging.AmazonSQSMessagingClientWrapper
This is a JMS Wrapper of
AmazonSQSClient. This class changes all
AmazonServiceException and AmazonClientException into
JMSException/JMSSecurityException.-
Constructor Summary
ConstructorsConstructorDescriptionAmazonSQSMessagingClientWrapper(com.amazonaws.services.sqs.AmazonSQS amazonSQSClient) AmazonSQSMessagingClientWrapper(com.amazonaws.services.sqs.AmazonSQS amazonSQSClient, com.amazonaws.auth.AWSCredentialsProvider credentialsProvider) -
Method Summary
Modifier and TypeMethodDescriptionvoidchangeMessageVisibility(com.amazonaws.services.sqs.model.ChangeMessageVisibilityRequest changeMessageVisibilityRequest) CallschangeMessageVisibilityand wrapsAmazonClientException.com.amazonaws.services.sqs.model.ChangeMessageVisibilityBatchResultchangeMessageVisibilityBatch(com.amazonaws.services.sqs.model.ChangeMessageVisibilityBatchRequest changeMessageVisibilityBatchRequest) CallschangeMessageVisibilityBatchand wrapsAmazonClientException.com.amazonaws.services.sqs.model.CreateQueueResultcreateQueue(com.amazonaws.services.sqs.model.CreateQueueRequest createQueueRequest) CallscreateQueueto create the queue with the provided queue attributes if any, and wrapsAmazonClientExceptioncom.amazonaws.services.sqs.model.CreateQueueResultcreateQueue(String queueName) CallscreateQueueto create the queue with the default queue attributes, and wrapsAmazonClientExceptionvoiddeleteMessage(com.amazonaws.services.sqs.model.DeleteMessageRequest deleteMessageRequest) CallsdeleteMessageand wrapsAmazonClientException.com.amazonaws.services.sqs.model.DeleteMessageBatchResultdeleteMessageBatch(com.amazonaws.services.sqs.model.DeleteMessageBatchRequest deleteMessageBatchRequest) CallsdeleteMessageBatchand wrapsAmazonClientException.com.amazonaws.services.sqs.AmazonSQSIf one uses any other AWS SDK operations other than explicitly listed here, the exceptions thrown by those operations will not be wrapped asJMSException.com.amazonaws.services.sqs.model.GetQueueUrlResultgetQueueUrl(com.amazonaws.services.sqs.model.GetQueueUrlRequest getQueueUrlRequest) CallsgetQueueUrland wrapsAmazonClientExceptioncom.amazonaws.services.sqs.model.GetQueueUrlResultgetQueueUrl(String queueName) Gets the queueUrl of a queue given a queue name.com.amazonaws.services.sqs.model.GetQueueUrlResultgetQueueUrl(String queueName, String queueOwnerAccountId) Gets the queueUrl of a queue given a queue name owned by the provided accountId.booleanqueueExists(String queueName) Check if the requested queue exists.booleanqueueExists(String queueName, String queueOwnerAccountId) Check if the requested queue exists.com.amazonaws.services.sqs.model.ReceiveMessageResultreceiveMessage(com.amazonaws.services.sqs.model.ReceiveMessageRequest receiveMessageRequest) CallsreceiveMessageand wrapsAmazonClientException.com.amazonaws.services.sqs.model.SendMessageResultsendMessage(com.amazonaws.services.sqs.model.SendMessageRequest sendMessageRequest) CallssendMessageand wrapsAmazonClientException.voidsetEndpoint(String endpoint) Deprecated.voidsetRegion(com.amazonaws.regions.Region region) Deprecated.
-
Constructor Details
-
AmazonSQSMessagingClientWrapper
public AmazonSQSMessagingClientWrapper(com.amazonaws.services.sqs.AmazonSQS amazonSQSClient) throws jakarta.jms.JMSException - Parameters:
amazonSQSClient- The AWS SDK Client for SQS.- Throws:
jakarta.jms.JMSException- if the client is null
-
AmazonSQSMessagingClientWrapper
public AmazonSQSMessagingClientWrapper(com.amazonaws.services.sqs.AmazonSQS amazonSQSClient, com.amazonaws.auth.AWSCredentialsProvider credentialsProvider) throws jakarta.jms.JMSException - Parameters:
amazonSQSClient- The AWS SDK Client for SQS.- Throws:
jakarta.jms.JMSException- if the client is null
-
-
Method Details
-
getAmazonSQSClient
public com.amazonaws.services.sqs.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 asJMSException.- Returns:
- amazonSQSClient
-
setEndpoint
Deprecated.Sets SQS endpoint and wraps IllegalArgumentException. Deprecated. Instead of manipulating settings of existing AmazonSQS client, provide correct configuration when creating it through SQSConnectionFactory constructors.- Parameters:
endpoint- The endpoint (ex: "sqs.us-east-1.amazonaws.com") of the region specific AWS endpoint this client will communicate with.- Throws:
jakarta.jms.JMSException- jmsException
-
setRegion
@Deprecated public void setRegion(com.amazonaws.regions.Region region) throws jakarta.jms.JMSException Deprecated.Sets SQS region and wrapsIllegalArgumentException. Deprecated. Instead of manipulating settings of existing AmazonSQS client, provide correct configuration when creating it through SQSConnectionFactory constructors.- Parameters:
region- The region this client will communicate with. SeeRegion.getRegion(com.amazonaws.regions.Regions)for accessing a given region.- Throws:
jakarta.jms.JMSException- jmsException
-
deleteMessage
public void deleteMessage(com.amazonaws.services.sqs.model.DeleteMessageRequest deleteMessageRequest) throws jakarta.jms.JMSException CallsdeleteMessageand wrapsAmazonClientException. 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 AmazonSQS.- Throws:
jakarta.jms.JMSException- jmsException
-
deleteMessageBatch
public com.amazonaws.services.sqs.model.DeleteMessageBatchResult deleteMessageBatch(com.amazonaws.services.sqs.model.DeleteMessageBatchRequest deleteMessageBatchRequest) throws jakarta.jms.JMSException CallsdeleteMessageBatchand wrapsAmazonClientException. 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 AmazonSQS. This is the batch version of deleteMessage. Max batch size is 10.- Returns:
- The response from the deleteMessageBatch service method, as returned by AmazonSQS
- Throws:
jakarta.jms.JMSException- jmsException
-
sendMessage
public com.amazonaws.services.sqs.model.SendMessageResult sendMessage(com.amazonaws.services.sqs.model.SendMessageRequest sendMessageRequest) throws jakarta.jms.JMSException CallssendMessageand wrapsAmazonClientException.- Parameters:
sendMessageRequest- Container for the necessary parameters to execute the sendMessage service method on AmazonSQS.- Returns:
- The response from the sendMessage service method, as returned by AmazonSQS
- Throws:
jakarta.jms.JMSException- jmsException
-
queueExists
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:
jakarta.jms.JMSException- jmsException
-
queueExists
public boolean queueExists(String queueName, String queueOwnerAccountId) throws jakarta.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:
jakarta.jms.JMSException- jmsException
-
getQueueUrl
public com.amazonaws.services.sqs.model.GetQueueUrlResult getQueueUrl(String queueName) throws jakarta.jms.JMSException Gets the queueUrl of a queue given a queue name.- Parameters:
queueName- name of the queue- Returns:
- The response from the GetQueueUrl service method, as returned by AmazonSQS, which will include queue`s URL
- Throws:
jakarta.jms.JMSException- jmsException
-
getQueueUrl
public com.amazonaws.services.sqs.model.GetQueueUrlResult getQueueUrl(String queueName, String queueOwnerAccountId) throws jakarta.jms.JMSException Gets the queueUrl of a queue given a queue name owned by the provided accountId.- Parameters:
queueName- name of the queuequeueOwnerAccountId- The AWS accountId of the account that created the queue- Returns:
- The response from the GetQueueUrl service method, as returned by AmazonSQS, which will include queue`s URL
- Throws:
jakarta.jms.JMSException- jmsException
-
getQueueUrl
public com.amazonaws.services.sqs.model.GetQueueUrlResult getQueueUrl(com.amazonaws.services.sqs.model.GetQueueUrlRequest getQueueUrlRequest) throws jakarta.jms.JMSException CallsgetQueueUrland wrapsAmazonClientException- Parameters:
getQueueUrlRequest- Container for the necessary parameters to execute the getQueueUrl service method on AmazonSQS.- Returns:
- The response from the GetQueueUrl service method, as returned by AmazonSQS, which will include queue`s URL
- Throws:
jakarta.jms.JMSException- jmsException
-
createQueue
public com.amazonaws.services.sqs.model.CreateQueueResult createQueue(String queueName) throws jakarta.jms.JMSException CallscreateQueueto create the queue with the default queue attributes, and wrapsAmazonClientException- Parameters:
queueName- name of the queue- Returns:
- The response from the createQueue service method, as returned by AmazonSQS. This call creates a new queue, or returns the URL of an existing one.
- Throws:
jakarta.jms.JMSException- jmsException
-
createQueue
public com.amazonaws.services.sqs.model.CreateQueueResult createQueue(com.amazonaws.services.sqs.model.CreateQueueRequest createQueueRequest) throws jakarta.jms.JMSException CallscreateQueueto create the queue with the provided queue attributes if any, and wrapsAmazonClientException- Parameters:
createQueueRequest- Container for the necessary parameters to execute the createQueue service method on AmazonSQS.- Returns:
- The response from the createQueue service method, as returned by AmazonSQS. This call creates a new queue, or returns the URL of an existing one.
- Throws:
jakarta.jms.JMSException- jmsException
-
receiveMessage
public com.amazonaws.services.sqs.model.ReceiveMessageResult receiveMessage(com.amazonaws.services.sqs.model.ReceiveMessageRequest receiveMessageRequest) throws jakarta.jms.JMSException CallsreceiveMessageand wrapsAmazonClientException. 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 AmazonSQS.- Returns:
- The response from the ReceiveMessage service method, as returned by AmazonSQS.
- Throws:
jakarta.jms.JMSException- jmsException
-
changeMessageVisibility
public void changeMessageVisibility(com.amazonaws.services.sqs.model.ChangeMessageVisibilityRequest changeMessageVisibilityRequest) throws jakarta.jms.JMSException CallschangeMessageVisibilityand wrapsAmazonClientException. 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 AmazonSQS.- Throws:
jakarta.jms.JMSException- jmsException
-
changeMessageVisibilityBatch
public com.amazonaws.services.sqs.model.ChangeMessageVisibilityBatchResult changeMessageVisibilityBatch(com.amazonaws.services.sqs.model.ChangeMessageVisibilityBatchRequest changeMessageVisibilityBatchRequest) throws jakarta.jms.JMSException CallschangeMessageVisibilityBatchand wrapsAmazonClientException. 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 AmazonSQS.- Returns:
- The response from the changeMessageVisibilityBatch service method, as returned by AmazonSQS.
- Throws:
jakarta.jms.JMSException- jmsException
-