49
49
50
50
51
51
/**
52
- * This is a JMS Wrapper of <code>AmazonSQSClient </code>. This class changes all
53
- * <code>AmazonServiceException </code> and <code>AmazonClientException </code> into
52
+ * This is a JMS Wrapper of <code>SqsClient </code>. This class changes all
53
+ * <code>AwsServiceException </code> and <code>SdkException </code> into
54
54
* JMSException/JMSSecurityException.
55
55
*/
56
56
public class AmazonSQSMessagingClientWrapper {
@@ -61,7 +61,7 @@ public class AmazonSQSMessagingClientWrapper {
61
61
/**
62
62
* List of exceptions that can classified as security. These exceptions
63
63
* are not thrown during connection-set-up rather after the service
64
- * calls of the <code>AmazonSQSClient </code>.
64
+ * calls of the <code>SqsClient </code>.
65
65
*/
66
66
SECURITY_EXCEPTION_ERROR_CODES = new HashSet <String >();
67
67
SECURITY_EXCEPTION_ERROR_CODES .add ("MissingClientTokenId" );
@@ -108,12 +108,12 @@ public SqsClient getAmazonSQSClient() {
108
108
}
109
109
110
110
/**
111
- * Calls <code>deleteMessage</code> and wraps <code>AmazonClientException </code>. This is used to
111
+ * Calls <code>deleteMessage</code> and wraps <code>SdkException </code>. This is used to
112
112
* acknowledge single messages, so that they can be deleted from SQS queue.
113
113
*
114
114
* @param deleteMessageRequest
115
115
* Container for the necessary parameters to execute the
116
- * deleteMessage service method on AmazonSQS .
116
+ * deleteMessage service method on SqsClient .
117
117
* @throws JMSException
118
118
*/
119
119
public void deleteMessage (DeleteMessageRequest deleteMessageRequest ) throws JMSException {
@@ -127,16 +127,16 @@ public void deleteMessage(DeleteMessageRequest deleteMessageRequest) throws JMSE
127
127
128
128
/**
129
129
* Calls <code>deleteMessageBatch</code> and wraps
130
- * <code>AmazonClientException </code>. This is used to acknowledge multiple
130
+ * <code>SdkException </code>. This is used to acknowledge multiple
131
131
* messages on client_acknowledge mode, so that they can be deleted from SQS
132
132
* queue.
133
133
*
134
134
* @param deleteMessageBatchRequest
135
135
* Container for the necessary parameters to execute the
136
- * deleteMessageBatch service method on AmazonSQS . This is the
136
+ * deleteMessageBatch service method on SqsClient . This is the
137
137
* batch version of deleteMessage. Max batch size is 10.
138
138
* @return The response from the deleteMessageBatch service method, as
139
- * returned by AmazonSQS
139
+ * returned by SqsClient
140
140
* @throws JMSException
141
141
*/
142
142
public DeleteMessageBatchResponse deleteMessageBatch (DeleteMessageBatchRequest deleteMessageBatchRequest ) throws JMSException {
@@ -154,9 +154,9 @@ public DeleteMessageBatchResponse deleteMessageBatch(DeleteMessageBatchRequest d
154
154
*
155
155
* @param sendMessageRequest
156
156
* Container for the necessary parameters to execute the
157
- * sendMessage service method on AmazonSQS .
157
+ * sendMessage service method on SqsClient .
158
158
* @return The response from the sendMessage service method, as returned by
159
- * AmazonSQS
159
+ * SqsClient
160
160
* @throws JMSException
161
161
*/
162
162
public SendMessageResponse sendMessage (SendMessageRequest sendMessageRequest ) throws JMSException {
@@ -225,7 +225,7 @@ public boolean queueExists(String queueName, String queueOwnerAccountId) throws
225
225
*
226
226
* @param queueName
227
227
* @return The response from the GetQueueUrl service method, as returned by
228
- * AmazonSQS , which will include queue`s URL
228
+ * SqsClient , which will include queue`s URL
229
229
* @throws JMSException
230
230
*/
231
231
public GetQueueUrlResponse getQueueUrl (String queueName ) throws JMSException {
@@ -241,7 +241,7 @@ public GetQueueUrlResponse getQueueUrl(String queueName) throws JMSException {
241
241
* @param queueName
242
242
* @param queueOwnerAccountId The AWS accountId of the account that created the queue
243
243
* @return The response from the GetQueueUrl service method, as returned by
244
- * AmazonSQS , which will include queue`s URL
244
+ * SqsClient , which will include queue`s URL
245
245
* @throws JMSException
246
246
*/
247
247
public GetQueueUrlResponse getQueueUrl (String queueName , String queueOwnerAccountId ) throws JMSException {
@@ -253,13 +253,13 @@ public GetQueueUrlResponse getQueueUrl(String queueName, String queueOwnerAccoun
253
253
}
254
254
255
255
/**
256
- * Calls <code>getQueueUrl</code> and wraps <code>AmazonClientException </code>
256
+ * Calls <code>getQueueUrl</code> and wraps <code>SdkException </code>
257
257
*
258
258
* @param getQueueUrlRequest
259
259
* Container for the necessary parameters to execute the
260
- * getQueueUrl service method on AmazonSQS .
260
+ * getQueueUrl service method on SqsClient .
261
261
* @return The response from the GetQueueUrl service method, as returned by
262
- * AmazonSQS , which will include queue`s URL
262
+ * SqsClient , which will include queue`s URL
263
263
* @throws JMSException
264
264
*/
265
265
public GetQueueUrlResponse getQueueUrl (GetQueueUrlRequest getQueueUrlRequest ) throws JMSException {
@@ -273,11 +273,11 @@ public GetQueueUrlResponse getQueueUrl(GetQueueUrlRequest getQueueUrlRequest) th
273
273
274
274
/**
275
275
* Calls <code>createQueue</code> to create the queue with the default queue attributes,
276
- * and wraps <code>AmazonClientException </code>
276
+ * and wraps <code>SdkException </code>
277
277
*
278
278
* @param queueName
279
279
* @return The response from the createQueue service method, as returned by
280
- * AmazonSQS . This call creates a new queue, or returns the URL of
280
+ * SqsClient . This call creates a new queue, or returns the URL of
281
281
* an existing one.
282
282
* @throws JMSException
283
283
*/
@@ -287,13 +287,13 @@ public CreateQueueResponse createQueue(String queueName) throws JMSException {
287
287
288
288
/**
289
289
* Calls <code>createQueue</code> to create the queue with the provided queue attributes
290
- * if any, and wraps <code>AmazonClientException </code>
290
+ * if any, and wraps <code>SdkException </code>
291
291
*
292
292
* @param createQueueRequest
293
293
* Container for the necessary parameters to execute the
294
- * createQueue service method on AmazonSQS .
294
+ * createQueue service method on SqsClient .
295
295
* @return The response from the createQueue service method, as returned by
296
- * AmazonSQS . This call creates a new queue, or returns the URL of
296
+ * SqsClient . This call creates a new queue, or returns the URL of
297
297
* an existing one.
298
298
* @throws JMSException
299
299
*/
@@ -307,16 +307,16 @@ public CreateQueueResponse createQueue(CreateQueueRequest createQueueRequest) th
307
307
}
308
308
309
309
/**
310
- * Calls <code>receiveMessage</code> and wraps <code>AmazonClientException </code>. Used by
310
+ * Calls <code>receiveMessage</code> and wraps <code>SdkException </code>. Used by
311
311
* {@link SQSMessageConsumerPrefetch} to receive up to minimum of
312
312
* (<code>numberOfMessagesToPrefetch</code>,10) messages from SQS queue into consumer
313
313
* prefetch buffers.
314
314
*
315
315
* @param receiveMessageRequest
316
316
* Container for the necessary parameters to execute the
317
- * receiveMessage service method on AmazonSQS .
317
+ * receiveMessage service method on SqsClient .
318
318
* @return The response from the ReceiveMessage service method, as returned
319
- * by AmazonSQS .
319
+ * by SqsClient .
320
320
* @throws JMSException
321
321
*/
322
322
public ReceiveMessageResponse receiveMessage (ReceiveMessageRequest receiveMessageRequest ) throws JMSException {
@@ -329,12 +329,12 @@ public ReceiveMessageResponse receiveMessage(ReceiveMessageRequest receiveMessag
329
329
}
330
330
331
331
/**
332
- * Calls <code>changeMessageVisibility</code> and wraps <code>AmazonClientException </code>. This is
332
+ * Calls <code>changeMessageVisibility</code> and wraps <code>SdkException </code>. This is
333
333
* used to for negative acknowledge of a single message, so that messages can be received again without any delay.
334
334
*
335
335
* @param changeMessageVisibilityRequest
336
336
* Container for the necessary parameters to execute the
337
- * changeMessageVisibility service method on AmazonSQS .
337
+ * changeMessageVisibility service method on SqsClient .
338
338
* @throws JMSException
339
339
*/
340
340
public void changeMessageVisibility (ChangeMessageVisibilityRequest changeMessageVisibilityRequest ) throws JMSException {
@@ -347,15 +347,15 @@ public void changeMessageVisibility(ChangeMessageVisibilityRequest changeMessage
347
347
}
348
348
349
349
/**
350
- * Calls <code>changeMessageVisibilityBatch</code> and wraps <code>AmazonClientException </code>. This is
350
+ * Calls <code>changeMessageVisibilityBatch</code> and wraps <code>SdkException </code>. This is
351
351
* used to for negative acknowledge of messages in batch, so that messages
352
352
* can be received again without any delay.
353
353
*
354
354
* @param changeMessageVisibilityBatchRequest
355
355
* Container for the necessary parameters to execute the
356
- * changeMessageVisibilityBatch service method on AmazonSQS .
356
+ * changeMessageVisibilityBatch service method on SqsClient .
357
357
* @return The response from the changeMessageVisibilityBatch service
358
- * method, as returned by AmazonSQS .
358
+ * method, as returned by SqsClient .
359
359
* @throws JMSException
360
360
*/
361
361
public ChangeMessageVisibilityBatchResponse changeMessageVisibilityBatch (ChangeMessageVisibilityBatchRequest changeMessageVisibilityBatchRequest )
@@ -369,7 +369,7 @@ public ChangeMessageVisibilityBatchResponse changeMessageVisibilityBatch(ChangeM
369
369
}
370
370
371
371
/**
372
- * Create generic error message for <code>AmazonServiceException </code>. Message include
372
+ * Create generic error message for <code>AwsServiceException </code>. Message include
373
373
* Action, RequestId, HTTPStatusCode, and AmazonErrorCode.
374
374
*/
375
375
private String logAndGetAmazonServiceException (AwsServiceException ase , String action ) {
@@ -380,7 +380,7 @@ private String logAndGetAmazonServiceException(AwsServiceException ase, String a
380
380
}
381
381
382
382
/**
383
- * Create generic error message for <code>AmazonClientException </code>. Message include
383
+ * Create generic error message for <code>SdkException </code>. Message include
384
384
* Action.
385
385
*/
386
386
private String logAndGetAmazonClientException (SdkException ace , String action ) {
@@ -412,8 +412,7 @@ private JMSException handleException(SdkException e, String operationName) throw
412
412
return jmsException ;
413
413
}
414
414
415
- private static String errorCode (AwsServiceException e )
416
- {
415
+ private static String errorCode (AwsServiceException e ) {
417
416
return e .awsErrorDetails () != null ? e .awsErrorDetails ().errorCode () : "" ;
418
417
}
419
418
@@ -423,9 +422,7 @@ private static boolean isJMSSecurityException(AwsServiceException e) {
423
422
}
424
423
425
424
private void prepareRequest (AwsRequest request ) {
426
-
427
- if (credentialsProvider != null )
428
- {
425
+ if (credentialsProvider != null ) {
429
426
request = request .toBuilder ().overrideConfiguration (AwsRequestOverrideConfiguration
430
427
.builder ()
431
428
.credentialsProvider (credentialsProvider )
0 commit comments