You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by ac...@apache.org on 2018/02/07 09:45:06 UTC
[camel] 09/10: CAMEL-12234 - Camel-AWS: Since we are using builders,
we need to remove the AWS endpoint options on the components that are using
them - AWS SQS
This is an automated email from the ASF dual-hosted git repository.
acosentino pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel.git
commit adfdda36cd6d4736ee292f13514badd58b2dbe5b
Author: Andrea Cosentino <an...@gmail.com>
AuthorDate: Wed Feb 7 10:38:19 2018 +0100
CAMEL-12234 - Camel-AWS: Since we are using builders, we need to remove the AWS endpoint options on the components that are using them - AWS SQS
---
components/camel-aws/src/main/docs/aws-sqs-component.adoc | 5 ++---
.../apache/camel/component/aws/sqs/SqsConfiguration.java | 15 ---------------
.../org/apache/camel/component/aws/sqs/SqsEndpoint.java | 11 +++--------
.../component/aws/sqs/SqsComponentConfigurationTest.java | 6 +-----
.../aws/sqs/springboot/SqsComponentConfiguration.java | 15 ---------------
5 files changed, 6 insertions(+), 46 deletions(-)
diff --git a/components/camel-aws/src/main/docs/aws-sqs-component.adoc b/components/camel-aws/src/main/docs/aws-sqs-component.adoc
index 43c2e35..e65bd08 100644
--- a/components/camel-aws/src/main/docs/aws-sqs-component.adoc
+++ b/components/camel-aws/src/main/docs/aws-sqs-component.adoc
@@ -66,14 +66,13 @@ with the following path and query parameters:
| *queueNameOrArn* | *Required* Queue name or ARN | | String
|===
-==== Query Parameters (47 parameters):
+==== Query Parameters (46 parameters):
[width="100%",cols="2,5,^1,2",options="header"]
|===
| Name | Description | Default | Type
| *amazonAWSHost* (common) | The hostname of the Amazon AWS cloud. | amazonaws.com | String
| *amazonSQSClient* (common) | To use the AmazonSQS as client | | AmazonSQS
-| *amazonSQSEndpoint* (common) | The region with which the AWS-SQS client wants to work with. Only works if Camel creates the AWS-SQS client i.e. if you explicitly set amazonSQSClient then this setting will have no effect. You would have to set it on the client you create directly | | String
| *headerFilterStrategy* (common) | To use a custom HeaderFilterStrategy to map headers to/from Camel. | | HeaderFilterStrategy
| *queueOwnerAWSAccountId* (common) | Specify the queue owner aws account id when you need to connect the queue with different account owner. | | String
| *region* (common) | Specify the queue region which could be used with queueOwnerAWSAccountId to build the service URL. | | String
@@ -248,4 +247,4 @@ consumers.
* link:endpoint.html[Endpoint]
* link:getting-started.html[Getting Started]
-* link:aws.html[AWS Component]
\ No newline at end of file
+* link:aws.html[AWS Component]
diff --git a/components/camel-aws/src/main/java/org/apache/camel/component/aws/sqs/SqsConfiguration.java b/components/camel-aws/src/main/java/org/apache/camel/component/aws/sqs/SqsConfiguration.java
index 5817506..d052976 100644
--- a/components/camel-aws/src/main/java/org/apache/camel/component/aws/sqs/SqsConfiguration.java
+++ b/components/camel-aws/src/main/java/org/apache/camel/component/aws/sqs/SqsConfiguration.java
@@ -35,8 +35,6 @@ public class SqsConfiguration implements Cloneable {
private String secretKey;
@UriParam(defaultValue = "amazonaws.com")
private String amazonAWSHost = "amazonaws.com";
- @UriParam
- private String amazonSQSEndpoint;
@UriParam(secret = true)
private String queueOwnerAWSAccountId;
@UriParam
@@ -100,19 +98,6 @@ public class SqsConfiguration implements Cloneable {
return false;
}
- /**
- * The region with which the AWS-SQS client wants to work with.
- * Only works if Camel creates the AWS-SQS client, i.e., if you explicitly set amazonSQSClient,
- * then this setting will have no effect. You would have to set it on the client you create directly
- */
- public void setAmazonSQSEndpoint(String amazonSQSEndpoint) {
- this.amazonSQSEndpoint = amazonSQSEndpoint;
- }
-
- public String getAmazonSQSEndpoint() {
- return amazonSQSEndpoint;
- }
-
public String getAmazonAWSHost() {
return amazonAWSHost;
}
diff --git a/components/camel-aws/src/main/java/org/apache/camel/component/aws/sqs/SqsEndpoint.java b/components/camel-aws/src/main/java/org/apache/camel/component/aws/sqs/SqsEndpoint.java
index f1b2dc3..7a7281e 100644
--- a/components/camel-aws/src/main/java/org/apache/camel/component/aws/sqs/SqsEndpoint.java
+++ b/components/camel-aws/src/main/java/org/apache/camel/component/aws/sqs/SqsEndpoint.java
@@ -25,6 +25,7 @@ import com.amazonaws.auth.AWSCredentialsProvider;
import com.amazonaws.auth.AWSStaticCredentialsProvider;
import com.amazonaws.auth.BasicAWSCredentials;
import com.amazonaws.client.builder.AwsClientBuilder.EndpointConfiguration;
+import com.amazonaws.regions.Regions;
import com.amazonaws.services.sqs.AmazonSQS;
import com.amazonaws.services.sqs.AmazonSQSClientBuilder;
import com.amazonaws.services.sqs.model.CreateQueueRequest;
@@ -116,11 +117,6 @@ public class SqsEndpoint extends ScheduledPollEndpoint implements HeaderFilterSt
client = getConfiguration().getAmazonSQSClient() != null
? getConfiguration().getAmazonSQSClient() : getClient();
- // Override the endpoint location
- if (ObjectHelper.isNotEmpty(getConfiguration().getAmazonSQSEndpoint())) {
- client.setEndpoint(getConfiguration().getAmazonSQSEndpoint());
- }
-
// check the setting the headerFilterStrategy
if (headerFilterStrategy == null) {
headerFilterStrategy = new SqsHeaderFilterStrategy();
@@ -306,9 +302,8 @@ public class SqsEndpoint extends ScheduledPollEndpoint implements HeaderFilterSt
clientBuilder = AmazonSQSClientBuilder.standard().withClientConfiguration(clientConfiguration);
}
}
- if (ObjectHelper.isNotEmpty(configuration.getAmazonSQSEndpoint()) && ObjectHelper.isNotEmpty(configuration.getRegion())) {
- EndpointConfiguration endpointConfiguration = new EndpointConfiguration(configuration.getAmazonSQSEndpoint(), configuration.getRegion());
- clientBuilder = clientBuilder.withEndpointConfiguration(endpointConfiguration);
+ if (ObjectHelper.isNotEmpty(configuration.getRegion())) {
+ clientBuilder = clientBuilder.withRegion(Regions.valueOf(configuration.getRegion()));
}
client = clientBuilder.build();
return client;
diff --git a/components/camel-aws/src/test/java/org/apache/camel/component/aws/sqs/SqsComponentConfigurationTest.java b/components/camel-aws/src/test/java/org/apache/camel/component/aws/sqs/SqsComponentConfigurationTest.java
index dce261b..240a48b 100644
--- a/components/camel-aws/src/test/java/org/apache/camel/component/aws/sqs/SqsComponentConfigurationTest.java
+++ b/components/camel-aws/src/test/java/org/apache/camel/component/aws/sqs/SqsComponentConfigurationTest.java
@@ -41,7 +41,6 @@ public class SqsComponentConfigurationTest extends CamelTestSupport {
assertNull(endpoint.getConfiguration().getMessageAttributeNames());
assertNull(endpoint.getConfiguration().getDefaultVisibilityTimeout());
assertNull(endpoint.getConfiguration().getVisibilityTimeout());
- assertNull(endpoint.getConfiguration().getAmazonSQSEndpoint());
assertNull(endpoint.getConfiguration().getMaximumMessageSize());
assertNull(endpoint.getConfiguration().getMessageRetentionPeriod());
assertNull(endpoint.getConfiguration().getPolicy());
@@ -61,7 +60,6 @@ public class SqsComponentConfigurationTest extends CamelTestSupport {
assertNull(endpoint.getConfiguration().getMessageAttributeNames());
assertNull(endpoint.getConfiguration().getDefaultVisibilityTimeout());
assertNull(endpoint.getConfiguration().getVisibilityTimeout());
- assertNull(endpoint.getConfiguration().getAmazonSQSEndpoint());
assertNull(endpoint.getConfiguration().getMaximumMessageSize());
assertNull(endpoint.getConfiguration().getMessageRetentionPeriod());
assertNull(endpoint.getConfiguration().getPolicy());
@@ -115,7 +113,6 @@ public class SqsComponentConfigurationTest extends CamelTestSupport {
assertNull(endpoint.getConfiguration().getMessageAttributeNames());
assertNull(endpoint.getConfiguration().getDefaultVisibilityTimeout());
assertNull(endpoint.getConfiguration().getVisibilityTimeout());
- assertNull(endpoint.getConfiguration().getAmazonSQSEndpoint());
assertNull(endpoint.getConfiguration().getMaximumMessageSize());
assertNull(endpoint.getConfiguration().getMessageRetentionPeriod());
assertNull(endpoint.getConfiguration().getPolicy());
@@ -130,7 +127,7 @@ public class SqsComponentConfigurationTest extends CamelTestSupport {
((JndiRegistry) ((PropertyPlaceholderDelegateRegistry) context.getRegistry()).getRegistry()).bind("amazonSQSClient", mock);
SqsComponent component = new SqsComponent(context);
- SqsEndpoint endpoint = (SqsEndpoint) component.createEndpoint("aws-sqs://MyQueue?amazonSQSClient=#amazonSQSClient&amazonSQSEndpoint=sns.eu-west-1.amazonaws.com&accessKey=xxx"
+ SqsEndpoint endpoint = (SqsEndpoint) component.createEndpoint("aws-sqs://MyQueue?amazonSQSClient=#amazonSQSClient&accessKey=xxx"
+ "&secretKey=yyy&attributeNames=color,size"
+ "&messageAttributeNames=msgColor,msgSize&DefaultVisibilityTimeout=1000&visibilityTimeout=2000&maximumMessageSize=65536&messageRetentionPeriod=1209600&policy="
+ "%7B%22Version%22%3A%222008-10-17%22%2C%22Id%22%3A%22%2F195004372649%2FMyQueue%2FSQSDefaultPolicy%22%2C%22Statement%22%3A%5B%7B%22Sid%22%3A%22Queue1ReceiveMessage%22%2C%22"
@@ -147,7 +144,6 @@ public class SqsComponentConfigurationTest extends CamelTestSupport {
assertEquals("msgColor,msgSize", endpoint.getConfiguration().getMessageAttributeNames());
assertEquals(new Integer(1000), endpoint.getConfiguration().getDefaultVisibilityTimeout());
assertEquals(new Integer(2000), endpoint.getConfiguration().getVisibilityTimeout());
- assertEquals("sns.eu-west-1.amazonaws.com", endpoint.getConfiguration().getAmazonSQSEndpoint());
assertEquals(new Integer(65536), endpoint.getConfiguration().getMaximumMessageSize());
assertEquals(new Integer(1209600), endpoint.getConfiguration().getMessageRetentionPeriod());
assertEquals("{\"Version\":\"2008-10-17\",\"Id\":\"/195004372649/MyQueue/SQSDefaultPolicy\",\"Statement\":[{\"Sid\":\"Queue1ReceiveMessage\",\"Effect\":\"Allow\",\"Principal\":"
diff --git a/platforms/spring-boot/components-starter/camel-aws-starter/src/main/java/org/apache/camel/component/aws/sqs/springboot/SqsComponentConfiguration.java b/platforms/spring-boot/components-starter/camel-aws-starter/src/main/java/org/apache/camel/component/aws/sqs/springboot/SqsComponentConfiguration.java
index 9d24428..1db47e5 100644
--- a/platforms/spring-boot/components-starter/camel-aws-starter/src/main/java/org/apache/camel/component/aws/sqs/springboot/SqsComponentConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-aws-starter/src/main/java/org/apache/camel/component/aws/sqs/springboot/SqsComponentConfiguration.java
@@ -102,13 +102,6 @@ public class SqsComponentConfiguration
public static class SqsConfigurationNestedConfiguration {
public static final Class CAMEL_NESTED_CLASS = org.apache.camel.component.aws.sqs.SqsConfiguration.class;
/**
- * The region with which the AWS-SQS client wants to work with. Only
- * works if Camel creates the AWS-SQS client, i.e., if you explicitly
- * set amazonSQSClient, then this setting will have no effect. You would
- * have to set it on the client you create directly
- */
- private String amazonSQSEndpoint;
- /**
* The hostname of the Amazon AWS cloud.
*/
private String amazonAWSHost = "amazonaws.com";
@@ -218,14 +211,6 @@ public class SqsComponentConfiguration
private String proxyHost;
private Integer proxyPort;
- public String getAmazonSQSEndpoint() {
- return amazonSQSEndpoint;
- }
-
- public void setAmazonSQSEndpoint(String amazonSQSEndpoint) {
- this.amazonSQSEndpoint = amazonSQSEndpoint;
- }
-
public String getAmazonAWSHost() {
return amazonAWSHost;
}
--
To stop receiving notification emails like this one, please contact
acosentino@apache.org.