Skip to content

Commit 56310e0

Browse files
authored
Revert "updating fork with master repo" (#2)
This reverts commit bec50bd.
1 parent bec50bd commit 56310e0

File tree

55 files changed

+391
-2205
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

55 files changed

+391
-2205
lines changed

NOTICE.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
Amazon SQS Java Messaging Library
2-
Copyright 2010-2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
2+
Copyright 2010-2014 Amazon.com, Inc. or its affiliates. All Rights Reserved.
33

44
This product includes software developed by
55
Amazon Technologies, Inc (http://www.amazon.com/).

README.md

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,22 +6,23 @@ for communicating with Amazon Simple Queue Service. This project builds on top o
66
* You can download release builds through the [releases section of this](https://github.com/awslabs/amazon-sqs-java-messaging-lib) project.
77
* For more information on using the amazon-sqs-java-messaging-lib, see our getting started guide to SQS [here](http://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/jmsclient.html).
88

9-
## Getting Started
9+
##Getting Started
1010

1111
* **Sign up for AWS** — Before you begin, you need an AWS account. For more information about creating an AWS account and retrieving your AWS credentials, see [AWS Account and Credentials](http://docs.aws.amazon.com/AWSSdkDocsJava/latest/DeveloperGuide/java-dg-setup.html) in the AWS SDK for Java Developer Guide.
12-
* **Minimum requirements** — To use the sample application, you'll need Java 7 (or later) and [Maven 3](http://maven.apache.org/). For more information about the requirements, see the [Getting Started](http://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/jmsclient.html) section of the Amazon SQS Developer Guide.
13-
* **Download** — Download the [latest release](https://github.com/awslabs/amazon-sqs-java-messaging-lib/releases) or pick it up from Maven:
12+
* **Sign up for Amazon SQS** — Go to the Amazon [SQS console](https://console.aws.amazon.com/sqs/home?region=us-east-1) to sign up for the service.
13+
* **Minimum requirements** — To use the sample application, you'll need Java 1.7+ and [Maven 3](http://maven.apache.org/). For more information about the requirements, see the [Getting Started](http://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/jmsclient.html) section of the Amazon SQS Developer Guide.
14+
* **Download** — Download the [latest preview release](https://github.com/awslabs/amazon-sqs-java-messaging-lib/releases) or pick it up from Maven:
1415
```xml
1516
<dependency>
1617
<groupId>com.amazonaws</groupId>
1718
<artifactId>amazon-sqs-java-messaging-lib</artifactId>
18-
<version>1.0.4</version>
19+
<version>1.0.0</version>
1920
<type>jar</type>
2021
</dependency>
2122
```
2223
* **Further information** - Read the [API documentation](http://aws.amazon.com/documentation/sqs/).
2324

24-
## Feedback
25+
##Feedback
2526
* Give us feedback [here](https://github.com/awslabs/amazon-sqs-java-messaging-lib/issues).
2627
* If you'd like to contribute a new feature or bug fix, we'd love to see Github pull requests from you.
2728

pom.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
<groupId>com.amazonaws</groupId>
88
<artifactId>amazon-sqs-java-messaging-lib</artifactId>
9-
<version>1.0.4</version>
9+
<version>1.0.1</version>
1010
<packaging>jar</packaging>
1111
<name>Amazon SQS Java Messaging Library</name>
1212
<description>The Amazon SQS Java Messaging Library holds the Java Message Service compatible classes, that are used
@@ -38,7 +38,7 @@
3838
</developers>
3939

4040
<properties>
41-
<aws-java-sdk.version>1.11.106</aws-java-sdk.version>
41+
<aws-java-sdk.version>1.11.18</aws-java-sdk.version>
4242
</properties>
4343

4444
<dependencies>

src/main/java/com/amazon/sqs/javamessaging/AmazonSQSMessagingClientWrapper.java

Lines changed: 13 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2010-2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
2+
* Copyright 2010-2014 Amazon.com, Inc. or its affiliates. All Rights Reserved.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License").
55
* You may not use this file except in compliance with the License.
@@ -26,8 +26,6 @@
2626

2727
import com.amazonaws.AmazonClientException;
2828
import com.amazonaws.AmazonServiceException;
29-
import com.amazonaws.AmazonWebServiceRequest;
30-
import com.amazonaws.auth.AWSCredentialsProvider;
3129
import com.amazonaws.regions.Region;
3230
import com.amazonaws.services.sqs.AmazonSQS;
3331
import com.amazonaws.services.sqs.model.ChangeMessageVisibilityBatchRequest;
@@ -69,7 +67,6 @@ public class AmazonSQSMessagingClientWrapper {
6967
}
7068

7169
private final AmazonSQS amazonSQSClient;
72-
private final AWSCredentialsProvider credentialsProvider;
7370

7471
/**
7572
* @param amazonSQSClient
@@ -78,21 +75,10 @@ public class AmazonSQSMessagingClientWrapper {
7875
* if the client is null
7976
*/
8077
public AmazonSQSMessagingClientWrapper(AmazonSQS amazonSQSClient) throws JMSException {
81-
this(amazonSQSClient, null);
82-
}
83-
84-
/**
85-
* @param amazonSQSClient
86-
* The AWS SDK Client for SQS.
87-
* @throws JMSException
88-
* if the client is null
89-
*/
90-
public AmazonSQSMessagingClientWrapper(AmazonSQS amazonSQSClient, AWSCredentialsProvider credentialsProvider) throws JMSException {
9178
if (amazonSQSClient == null) {
9279
throw new JMSException("Amazon SQS client cannot be null");
9380
}
9481
this.amazonSQSClient = amazonSQSClient;
95-
this.credentialsProvider = credentialsProvider;
9682
}
9783

9884
/**
@@ -106,15 +92,13 @@ public AmazonSQS getAmazonSQSClient() {
10692
}
10793

10894
/**
109-
* Sets SQS endpoint and wraps IllegalArgumentException.
110-
* Deprecated. Instead of manipulating settings of existing AmazonSQS client, provide correct configuration when creating it through SQSConnectionFactory constructors.
95+
* Sets SQS endpoint and wraps IllegalArgumentException.
11196
*
11297
* @param endpoint
11398
* The endpoint (ex: "sqs.us-east-1.amazonaws.com") of the region
11499
* specific AWS endpoint this client will communicate with.
115100
* @throws JMSException
116101
*/
117-
@Deprecated
118102
public void setEndpoint(String endpoint) throws JMSException {
119103
try {
120104
amazonSQSClient.setEndpoint(endpoint);
@@ -125,16 +109,15 @@ public void setEndpoint(String endpoint) throws JMSException {
125109
}
126110

127111
/**
128-
* Sets SQS region and wraps <code>IllegalArgumentException</code>.
129-
* Deprecated. Instead of manipulating settings of existing AmazonSQS client, provide correct configuration when creating it through SQSConnectionFactory constructors.
112+
* Sets SQS region and wraps <code>IllegalArgumentException</code>. This is the recommend
113+
* way to set-up the SQS end-points.
130114
*
131115
* @param region
132116
* The region this client will communicate with. See
133117
* {@link Region#getRegion(com.amazonaws.regions.Regions)} for
134118
* accessing a given region.
135119
* @throws JMSException
136120
*/
137-
@Deprecated
138121
public void setRegion(Region region) throws JMSException {
139122
try {
140123
amazonSQSClient.setRegion(region);
@@ -155,7 +138,6 @@ public void setRegion(Region region) throws JMSException {
155138
*/
156139
public void deleteMessage(DeleteMessageRequest deleteMessageRequest) throws JMSException {
157140
try {
158-
prepareRequest(deleteMessageRequest);
159141
amazonSQSClient.deleteMessage(deleteMessageRequest);
160142
} catch (AmazonClientException e) {
161143
throw handleException(e, "deleteMessage");
@@ -178,7 +160,6 @@ public void deleteMessage(DeleteMessageRequest deleteMessageRequest) throws JMSE
178160
*/
179161
public DeleteMessageBatchResult deleteMessageBatch(DeleteMessageBatchRequest deleteMessageBatchRequest) throws JMSException {
180162
try {
181-
prepareRequest(deleteMessageBatchRequest);
182163
return amazonSQSClient.deleteMessageBatch(deleteMessageBatchRequest);
183164
} catch (AmazonClientException e) {
184165
throw handleException(e, "deleteMessageBatch");
@@ -198,7 +179,6 @@ public DeleteMessageBatchResult deleteMessageBatch(DeleteMessageBatchRequest del
198179
*/
199180
public SendMessageResult sendMessage(SendMessageRequest sendMessageRequest) throws JMSException {
200181
try {
201-
prepareRequest(sendMessageRequest);
202182
return amazonSQSClient.sendMessage(sendMessageRequest);
203183
} catch (AmazonClientException e) {
204184
throw handleException(e, "sendMessage");
@@ -217,7 +197,7 @@ public SendMessageResult sendMessage(SendMessageRequest sendMessageRequest) thro
217197
*/
218198
public boolean queueExists(String queueName) throws JMSException {
219199
try {
220-
amazonSQSClient.getQueueUrl(prepareRequest(new GetQueueUrlRequest(queueName)));
200+
amazonSQSClient.getQueueUrl(new GetQueueUrlRequest(queueName));
221201
return true;
222202
} catch (QueueDoesNotExistException e) {
223203
return false;
@@ -243,7 +223,6 @@ public boolean queueExists(String queueName, String queueOwnerAccountId) throws
243223
try {
244224
GetQueueUrlRequest getQueueUrlRequest = new GetQueueUrlRequest(queueName);
245225
getQueueUrlRequest.setQueueOwnerAWSAccountId(queueOwnerAccountId);
246-
prepareRequest(getQueueUrlRequest);
247226
amazonSQSClient.getQueueUrl(getQueueUrlRequest);
248227
return true;
249228
} catch (QueueDoesNotExistException e) {
@@ -275,7 +254,9 @@ public GetQueueUrlResult getQueueUrl(String queueName) throws JMSException {
275254
* @throws JMSException
276255
*/
277256
public GetQueueUrlResult getQueueUrl(String queueName, String queueOwnerAccountId) throws JMSException {
278-
return getQueueUrl(new GetQueueUrlRequest(queueName).withQueueOwnerAWSAccountId(queueOwnerAccountId));
257+
GetQueueUrlRequest getQueueUrlRequest = new GetQueueUrlRequest(queueName);
258+
getQueueUrlRequest.setQueueOwnerAWSAccountId(queueOwnerAccountId);
259+
return getQueueUrl(getQueueUrlRequest);
279260
}
280261

281262
/**
@@ -290,7 +271,6 @@ public GetQueueUrlResult getQueueUrl(String queueName, String queueOwnerAccountI
290271
*/
291272
public GetQueueUrlResult getQueueUrl(GetQueueUrlRequest getQueueUrlRequest) throws JMSException {
292273
try {
293-
prepareRequest(getQueueUrlRequest);
294274
return amazonSQSClient.getQueueUrl(getQueueUrlRequest);
295275
} catch (AmazonClientException e) {
296276
throw handleException(e, "getQueueUrl");
@@ -308,7 +288,11 @@ public GetQueueUrlResult getQueueUrl(GetQueueUrlRequest getQueueUrlRequest) thro
308288
* @throws JMSException
309289
*/
310290
public CreateQueueResult createQueue(String queueName) throws JMSException {
311-
return createQueue(new CreateQueueRequest(queueName));
291+
try {
292+
return amazonSQSClient.createQueue(queueName);
293+
} catch (AmazonClientException e) {
294+
throw handleException(e, "createQueue");
295+
}
312296
}
313297

314298
/**
@@ -325,7 +309,6 @@ public CreateQueueResult createQueue(String queueName) throws JMSException {
325309
*/
326310
public CreateQueueResult createQueue(CreateQueueRequest createQueueRequest) throws JMSException {
327311
try {
328-
prepareRequest(createQueueRequest);
329312
return amazonSQSClient.createQueue(createQueueRequest);
330313
} catch (AmazonClientException e) {
331314
throw handleException(e, "createQueue");
@@ -347,7 +330,6 @@ public CreateQueueResult createQueue(CreateQueueRequest createQueueRequest) thro
347330
*/
348331
public ReceiveMessageResult receiveMessage(ReceiveMessageRequest receiveMessageRequest) throws JMSException {
349332
try {
350-
prepareRequest(receiveMessageRequest);
351333
return amazonSQSClient.receiveMessage(receiveMessageRequest);
352334
} catch (AmazonClientException e) {
353335
throw handleException(e, "receiveMessage");
@@ -365,7 +347,6 @@ public ReceiveMessageResult receiveMessage(ReceiveMessageRequest receiveMessageR
365347
*/
366348
public void changeMessageVisibility(ChangeMessageVisibilityRequest changeMessageVisibilityRequest) throws JMSException {
367349
try {
368-
prepareRequest(changeMessageVisibilityRequest);
369350
amazonSQSClient.changeMessageVisibility(changeMessageVisibilityRequest);
370351
} catch (AmazonClientException e) {
371352
throw handleException(e, "changeMessageVisibility");
@@ -387,7 +368,6 @@ public void changeMessageVisibility(ChangeMessageVisibilityRequest changeMessage
387368
public ChangeMessageVisibilityBatchResult changeMessageVisibilityBatch(ChangeMessageVisibilityBatchRequest changeMessageVisibilityBatchRequest)
388369
throws JMSException {
389370
try {
390-
prepareRequest(changeMessageVisibilityBatchRequest);
391371
return amazonSQSClient.changeMessageVisibilityBatch(changeMessageVisibilityBatchRequest);
392372
} catch (AmazonClientException e) {
393373
throw handleException(e, "changeMessageVisibilityBatch");
@@ -442,13 +422,4 @@ private JMSException handleException(AmazonClientException e, String operationNa
442422
private boolean isJMSSecurityException(AmazonServiceException e) {
443423
return SECURITY_EXCEPTION_ERROR_CODES.contains(e.getErrorCode()) ;
444424
}
445-
446-
private <T extends AmazonWebServiceRequest> T prepareRequest(T request) {
447-
request.getRequestClientOptions().appendUserAgent(SQSMessagingClientConstants.APPENDED_USER_AGENT_HEADER_VERSION);
448-
if (credentialsProvider != null) {
449-
request.setRequestCredentialsProvider(credentialsProvider);
450-
}
451-
return request;
452-
}
453-
454425
}

src/main/java/com/amazon/sqs/javamessaging/PrefetchManager.java

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2010-2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
2+
* Copyright 2010-2014 Amazon.com, Inc. or its affiliates. All Rights Reserved.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License").
55
* You may not use this file except in compliance with the License.
@@ -27,12 +27,6 @@ public interface PrefetchManager {
2727
*/
2828
public void messageDispatched();
2929

30-
/**
31-
* Notify the prefetchThread that the message listener has finished with any
32-
* previous message and is ready to accept another.
33-
*/
34-
public void messageListenerReady();
35-
3630
/**
3731
* This is used to determine the state of the consumer, when the message
3832
* listener scheduler is processing the messages.

src/main/java/com/amazon/sqs/javamessaging/ProviderConfiguration.java

Lines changed: 0 additions & 41 deletions
This file was deleted.

src/main/java/com/amazon/sqs/javamessaging/SQSConnection.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2010-2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
2+
* Copyright 2010-2014 Amazon.com, Inc. or its affiliates. All Rights Reserved.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License").
55
* You may not use this file except in compliance with the License.
@@ -18,8 +18,11 @@
1818
import java.util.Set;
1919
import java.util.concurrent.ConcurrentHashMap;
2020

21+
2122
import javax.jms.IllegalStateException;
23+
2224
import javax.jms.Connection;
25+
2326
import javax.jms.ConnectionConsumer;
2427
import javax.jms.ConnectionMetaData;
2528
import javax.jms.Destination;
@@ -90,8 +93,7 @@ public class SQSConnection implements Connection, QueueConnection {
9093

9194
/**
9295
* Configures the amount of messages that can be prefetched by a consumer. A
93-
* single consumer cannot prefetch more than 10 messages in a single call to SQS,
94-
* but it will make multiple calls as necessary.
96+
* single consumer cannot prefetch more than 10 messages.
9597
*/
9698
private final int numberOfMessagesToPrefetch;
9799
private volatile boolean closed = false;

0 commit comments

Comments
 (0)