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 2019/09/29 14:39:47 UTC

[camel] branch master updated (943d7e2 -> 7bc754b)

This is an automated email from the ASF dual-hosted git repository.

acosentino pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/camel.git.


    from 943d7e2  Upgrade Async Http Client to version 2.10.3
     new 034180d  Fix not honoring the amazonAWSHost (CAMEL-14002)
     new 3971b22  Do use the client configuration instance if it's given
     new ffc66fa  CAMEL-14002 - Regen docs
     new 7bc754b  Regen docs - this closes pull requests #3201 #3202

The 4 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../src/main/docs/aws-sqs-component.adoc           |  3 +-
 .../camel/component/aws/sqs/SqsConfiguration.java  | 15 +++++++
 .../camel/component/aws/sqs/SqsEndpoint.java       | 50 ++++++++++++++++++----
 .../endpoint/dsl/SqsEndpointBuilderFactory.java    | 33 ++++++++++++++
 .../modules/ROOT/pages/aws-sqs-component.adoc      |  3 +-
 .../sqs/springboot/SqsComponentConfiguration.java  | 12 ++++++
 6 files changed, 106 insertions(+), 10 deletions(-)


[camel] 02/04: Do use the client configuration instance if it's given

Posted by ac...@apache.org.
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 3971b22485de762f910068916dc12323f05904c3
Author: Otavio Rodolfo Piske <op...@redhat.com>
AuthorDate: Thu Sep 26 14:51:04 2019 +0200

    Do use the client configuration instance if it's given
---
 .../src/main/java/org/apache/camel/component/aws/sqs/SqsEndpoint.java | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/components/camel-aws-sqs/src/main/java/org/apache/camel/component/aws/sqs/SqsEndpoint.java b/components/camel-aws-sqs/src/main/java/org/apache/camel/component/aws/sqs/SqsEndpoint.java
index f1a1552..07f1e6a 100644
--- a/components/camel-aws-sqs/src/main/java/org/apache/camel/component/aws/sqs/SqsEndpoint.java
+++ b/components/camel-aws-sqs/src/main/java/org/apache/camel/component/aws/sqs/SqsEndpoint.java
@@ -358,9 +358,9 @@ public class SqsEndpoint extends ScheduledPollEndpoint implements HeaderFilterSt
             }
         } else {
             if (isClientConfigFound) {
-                clientBuilder = AmazonSQSClientBuilder.standard();
-            } else {
                 clientBuilder = AmazonSQSClientBuilder.standard().withClientConfiguration(clientConfiguration);
+            } else {
+                clientBuilder = AmazonSQSClientBuilder.standard();
             }
         }
 


[camel] 03/04: CAMEL-14002 - Regen docs

Posted by ac...@apache.org.
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 ffc66fad217477e48991e0945c96ac795917c8d0
Author: Andrea Cosentino <an...@gmail.com>
AuthorDate: Sun Sep 29 16:27:14 2019 +0200

    CAMEL-14002 - Regen docs
---
 .../src/main/docs/aws-sqs-component.adoc           |  3 +-
 .../endpoint/dsl/SqsEndpointBuilderFactory.java    | 33 ++++++++++++++++++++++
 .../sqs/springboot/SqsComponentConfiguration.java  | 12 ++++++++
 3 files changed, 47 insertions(+), 1 deletion(-)

diff --git a/components/camel-aws-sqs/src/main/docs/aws-sqs-component.adoc b/components/camel-aws-sqs/src/main/docs/aws-sqs-component.adoc
index edd74b4..0c68104 100644
--- a/components/camel-aws-sqs/src/main/docs/aws-sqs-component.adoc
+++ b/components/camel-aws-sqs/src/main/docs/aws-sqs-component.adoc
@@ -68,7 +68,7 @@ with the following path and query parameters:
 |===
 
 
-=== Query Parameters (55 parameters):
+=== Query Parameters (56 parameters):
 
 
 [width="100%",cols="2,5,^1,2",options="header"]
@@ -78,6 +78,7 @@ with the following path and query parameters:
 | *amazonSQSClient* (common) | To use the AmazonSQS as client |  | AmazonSQS
 | *autoCreateQueue* (common) | Setting the autocreation of the queue | true | boolean
 | *headerFilterStrategy* (common) | To use a custom HeaderFilterStrategy to map headers to/from Camel. |  | HeaderFilterStrategy
+| *protocol* (common) | The underlying protocol used to communicate with SQS | https | String
 | *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. When using this parameter, the configuration will expect the capitalized name of the region (for example AP_EAST_1) You'll need to use the name Regions.EU_WEST_1.name() |  | String
 | *attributeNames* (consumer) | A list of attribute names to receive when consuming. Multiple names can be separated by comma. |  | String
diff --git a/core/camel-endpointdsl/src/main/java/org/apache/camel/builder/endpoint/dsl/SqsEndpointBuilderFactory.java b/core/camel-endpointdsl/src/main/java/org/apache/camel/builder/endpoint/dsl/SqsEndpointBuilderFactory.java
index d52d600..d15ef0d 100644
--- a/core/camel-endpointdsl/src/main/java/org/apache/camel/builder/endpoint/dsl/SqsEndpointBuilderFactory.java
+++ b/core/camel-endpointdsl/src/main/java/org/apache/camel/builder/endpoint/dsl/SqsEndpointBuilderFactory.java
@@ -137,6 +137,17 @@ public interface SqsEndpointBuilderFactory {
             return this;
         }
         /**
+         * The underlying protocol used to communicate with SQS.
+         * 
+         * The option is a: <code>java.lang.String</code> type.
+         * 
+         * Group: common
+         */
+        default SqsEndpointConsumerBuilder protocol(String protocol) {
+            doSetProperty("protocol", protocol);
+            return this;
+        }
+        /**
          * Specify the queue owner aws account id when you need to connect the
          * queue with different account owner.
          * 
@@ -1325,6 +1336,17 @@ public interface SqsEndpointBuilderFactory {
             return this;
         }
         /**
+         * The underlying protocol used to communicate with SQS.
+         * 
+         * The option is a: <code>java.lang.String</code> type.
+         * 
+         * Group: common
+         */
+        default SqsEndpointProducerBuilder protocol(String protocol) {
+            doSetProperty("protocol", protocol);
+            return this;
+        }
+        /**
          * Specify the queue owner aws account id when you need to connect the
          * queue with different account owner.
          * 
@@ -1864,6 +1886,17 @@ public interface SqsEndpointBuilderFactory {
             return this;
         }
         /**
+         * The underlying protocol used to communicate with SQS.
+         * 
+         * The option is a: <code>java.lang.String</code> type.
+         * 
+         * Group: common
+         */
+        default SqsEndpointBuilder protocol(String protocol) {
+            doSetProperty("protocol", protocol);
+            return this;
+        }
+        /**
          * Specify the queue owner aws account id when you need to connect the
          * queue with different account owner.
          * 
diff --git a/platforms/spring-boot/components-starter/camel-aws-sqs-starter/src/main/java/org/apache/camel/component/aws/sqs/springboot/SqsComponentConfiguration.java b/platforms/spring-boot/components-starter/camel-aws-sqs-starter/src/main/java/org/apache/camel/component/aws/sqs/springboot/SqsComponentConfiguration.java
index 49af144..c750214 100644
--- a/platforms/spring-boot/components-starter/camel-aws-sqs-starter/src/main/java/org/apache/camel/component/aws/sqs/springboot/SqsComponentConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-aws-sqs-starter/src/main/java/org/apache/camel/component/aws/sqs/springboot/SqsComponentConfiguration.java
@@ -281,6 +281,10 @@ public class SqsComponentConfiguration
          * Setting the autocreation of the queue
          */
         private Boolean autoCreateQueue = true;
+        /**
+         * The underlying protocol used to communicate with SQS
+         */
+        private String protocol = "https";
 
         public String getAmazonAWSHost() {
             return amazonAWSHost;
@@ -550,5 +554,13 @@ public class SqsComponentConfiguration
         public void setAutoCreateQueue(Boolean autoCreateQueue) {
             this.autoCreateQueue = autoCreateQueue;
         }
+
+        public String getProtocol() {
+            return protocol;
+        }
+
+        public void setProtocol(String protocol) {
+            this.protocol = protocol;
+        }
     }
 }
\ No newline at end of file


[camel] 01/04: Fix not honoring the amazonAWSHost (CAMEL-14002)

Posted by ac...@apache.org.
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 034180d93374892ddbedc6b0e254542b6c2a5ffe
Author: Otavio Rodolfo Piske <op...@redhat.com>
AuthorDate: Fri Sep 20 15:12:14 2019 +0200

    Fix not honoring the amazonAWSHost (CAMEL-14002)
---
 .../camel/component/aws/sqs/SqsConfiguration.java  | 15 +++++++
 .../camel/component/aws/sqs/SqsEndpoint.java       | 46 +++++++++++++++++++---
 2 files changed, 55 insertions(+), 6 deletions(-)

diff --git a/components/camel-aws-sqs/src/main/java/org/apache/camel/component/aws/sqs/SqsConfiguration.java b/components/camel-aws-sqs/src/main/java/org/apache/camel/component/aws/sqs/SqsConfiguration.java
index 01dc10e..869699d 100644
--- a/components/camel-aws-sqs/src/main/java/org/apache/camel/component/aws/sqs/SqsConfiguration.java
+++ b/components/camel-aws-sqs/src/main/java/org/apache/camel/component/aws/sqs/SqsConfiguration.java
@@ -101,6 +101,10 @@ public class SqsConfiguration implements Cloneable {
     @UriParam(label = "queue")
     private String redrivePolicy;
 
+    // Likely used only for testing
+    @UriParam(defaultValue = "https")
+    private String protocol = "https";
+
     /**
      * Whether or not the queue is a FIFO queue
      */
@@ -531,6 +535,17 @@ public class SqsConfiguration implements Cloneable {
         this.autoCreateQueue = autoCreateQueue;
     }
 
+    public String getProtocol() {
+        return protocol;
+    }
+
+    /**
+     * The underlying protocol used to communicate with SQS
+     */
+    public void setProtocol(String protocol) {
+        this.protocol = protocol;
+    }
+
     // *************************************************
     //
     // *************************************************
diff --git a/components/camel-aws-sqs/src/main/java/org/apache/camel/component/aws/sqs/SqsEndpoint.java b/components/camel-aws-sqs/src/main/java/org/apache/camel/component/aws/sqs/SqsEndpoint.java
index 8fb6d86..f1a1552 100644
--- a/components/camel-aws-sqs/src/main/java/org/apache/camel/component/aws/sqs/SqsEndpoint.java
+++ b/components/camel-aws-sqs/src/main/java/org/apache/camel/component/aws/sqs/SqsEndpoint.java
@@ -20,10 +20,12 @@ import java.util.HashMap;
 import java.util.Map.Entry;
 
 import com.amazonaws.ClientConfiguration;
+import com.amazonaws.Protocol;
 import com.amazonaws.auth.AWSCredentials;
 import com.amazonaws.auth.AWSCredentialsProvider;
 import com.amazonaws.auth.AWSStaticCredentialsProvider;
 import com.amazonaws.auth.BasicAWSCredentials;
+import com.amazonaws.client.builder.AwsClientBuilder;
 import com.amazonaws.regions.Regions;
 import com.amazonaws.services.sqs.AmazonSQS;
 import com.amazonaws.services.sqs.AmazonSQSClientBuilder;
@@ -107,6 +109,21 @@ public class SqsEndpoint extends ScheduledPollEndpoint implements HeaderFilterSt
         return sqsConsumer;
     }
 
+    /*
+     If using a different AWS host, do not assume specific parts of the AWS host
+     and, instead, just return whatever is provided as the host.
+     */
+    private String getFullyQualifiedAWSHost() {
+        String host = configuration.getAmazonAWSHost();
+        host = FileUtil.stripTrailingSeparator(host);
+
+        if (host.equals("amazonaws.com")) {
+            return "sqs." + Regions.valueOf(configuration.getRegion()).getName() + "." + host;
+        }
+
+        return host;
+    }
+
     @Override
     protected void doInit() throws Exception {
         super.doInit();
@@ -125,9 +142,9 @@ public class SqsEndpoint extends ScheduledPollEndpoint implements HeaderFilterSt
             // This allows accessing queues where you don't have permission to
             // list queues or query queues
             if (configuration.getRegion() != null && configuration.getQueueOwnerAWSAccountId() != null) {
-                String host = configuration.getAmazonAWSHost();
-                host = FileUtil.stripTrailingSeparator(host);
-                queueUrl = "https://sqs." + Regions.valueOf(configuration.getRegion()).getName() + "." + host + "/" + configuration.getQueueOwnerAWSAccountId() + "/"
+                String protocol = configuration.getProtocol();
+
+                queueUrl = protocol + "://" + getFullyQualifiedAWSHost() + "/" + configuration.getQueueOwnerAWSAccountId() + "/"
                            + configuration.getQueueName();
             } else if (configuration.getQueueOwnerAWSAccountId() != null) {
                 GetQueueUrlRequest getQueueUrlRequest = new GetQueueUrlRequest();
@@ -318,6 +335,19 @@ public class SqsEndpoint extends ScheduledPollEndpoint implements HeaderFilterSt
             clientConfiguration.setProxyPort(configuration.getProxyPort());
             isClientConfigFound = true;
         }
+
+        final String protocol = configuration.getProtocol(); 
+
+        if (protocol.equals("http")) {
+            log.trace("Configuring AWS-SQS for HTTP protocol");
+            if (isClientConfigFound) {
+                clientConfiguration = clientConfiguration.withProtocol(Protocol.HTTP);
+            } else {
+                clientConfiguration = new ClientConfiguration().withProtocol(Protocol.HTTP);
+                isClientConfigFound = true;
+            }
+        }
+
         if (configuration.getAccessKey() != null && configuration.getSecretKey() != null) {
             AWSCredentials credentials = new BasicAWSCredentials(configuration.getAccessKey(), configuration.getSecretKey());
             AWSCredentialsProvider credentialsProvider = new AWSStaticCredentialsProvider(credentials);
@@ -333,9 +363,13 @@ public class SqsEndpoint extends ScheduledPollEndpoint implements HeaderFilterSt
                 clientBuilder = AmazonSQSClientBuilder.standard().withClientConfiguration(clientConfiguration);
             }
         }
-        if (ObjectHelper.isNotEmpty(configuration.getRegion())) {
-            clientBuilder = clientBuilder.withRegion(Regions.valueOf(configuration.getRegion()));
-        }
+
+        final String host = getFullyQualifiedAWSHost();
+        final String region = Regions.valueOf(configuration.getRegion()).getName();
+
+        log.debug("Creating endpoint for host {} on region {}", host, region);
+        clientBuilder.withEndpointConfiguration(new AwsClientBuilder.EndpointConfiguration(host, region));
+
         client = clientBuilder.build();
         return client;
     }


[camel] 04/04: Regen docs - this closes pull requests #3201 #3202

Posted by ac...@apache.org.
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 7bc754b579a73fe9d43fcb7672f6d7ecc0edb096
Author: Andrea Cosentino <an...@gmail.com>
AuthorDate: Sun Sep 29 16:38:31 2019 +0200

    Regen docs - this closes pull requests #3201 #3202
---
 docs/components/modules/ROOT/pages/aws-sqs-component.adoc | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/docs/components/modules/ROOT/pages/aws-sqs-component.adoc b/docs/components/modules/ROOT/pages/aws-sqs-component.adoc
index 7060aa5..6376248 100644
--- a/docs/components/modules/ROOT/pages/aws-sqs-component.adoc
+++ b/docs/components/modules/ROOT/pages/aws-sqs-component.adoc
@@ -69,7 +69,7 @@ with the following path and query parameters:
 |===
 
 
-=== Query Parameters (55 parameters):
+=== Query Parameters (56 parameters):
 
 
 [width="100%",cols="2,5,^1,2",options="header"]
@@ -79,6 +79,7 @@ with the following path and query parameters:
 | *amazonSQSClient* (common) | To use the AmazonSQS as client |  | AmazonSQS
 | *autoCreateQueue* (common) | Setting the autocreation of the queue | true | boolean
 | *headerFilterStrategy* (common) | To use a custom HeaderFilterStrategy to map headers to/from Camel. |  | HeaderFilterStrategy
+| *protocol* (common) | The underlying protocol used to communicate with SQS | https | String
 | *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. When using this parameter, the configuration will expect the capitalized name of the region (for example AP_EAST_1) You'll need to use the name Regions.EU_WEST_1.name() |  | String
 | *attributeNames* (consumer) | A list of attribute names to receive when consuming. Multiple names can be separated by comma. |  | String