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 2017/08/24 06:26:35 UTC

camel git commit: CAMEL-11697 - S3 Consumer: If maxMessagesPerPoll is greater than 50 consumer fails to poll objects from bucket - Set the maxConnections equals to default value + maxMessagesPoll

Repository: camel
Updated Branches:
  refs/heads/master ed36cf334 -> 8163a8f0e


CAMEL-11697 - S3 Consumer: If maxMessagesPerPoll is greater than 50 consumer fails to poll objects from bucket - Set the maxConnections equals to default value + maxMessagesPoll


Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/8163a8f0
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/8163a8f0
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/8163a8f0

Branch: refs/heads/master
Commit: 8163a8f0ea72a8578b1986191f585b1162c0d667
Parents: ed36cf3
Author: Andrea Cosentino <an...@gmail.com>
Authored: Thu Aug 24 08:25:10 2017 +0200
Committer: Andrea Cosentino <an...@gmail.com>
Committed: Thu Aug 24 08:26:19 2017 +0200

----------------------------------------------------------------------
 .../camel-aws/src/main/docs/aws-s3-component.adoc  |  2 +-
 .../camel/component/aws/s3/S3Configuration.java    | 13 -------------
 .../apache/camel/component/aws/s3/S3Endpoint.java  | 17 +++++++++++++++--
 3 files changed, 16 insertions(+), 16 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/8163a8f0/components/camel-aws/src/main/docs/aws-s3-component.adoc
----------------------------------------------------------------------
diff --git a/components/camel-aws/src/main/docs/aws-s3-component.adoc b/components/camel-aws/src/main/docs/aws-s3-component.adoc
index 524b790..8ec277b 100644
--- a/components/camel-aws/src/main/docs/aws-s3-component.adoc
+++ b/components/camel-aws/src/main/docs/aws-s3-component.adoc
@@ -81,7 +81,7 @@ with the following path and query parameters:
 | **deleteAfterRead** (consumer) | Delete objects from S3 after they have been retrieved. The delete is only performed if the Exchange is committed. If a rollback occurs the object is not deleted. If this option is false then the same objects will be retrieve over and over again on the polls. Therefore you need to use the Idempotent Consumer EIP in the route to filter out duplicates. You can filter using the link S3ConstantsBUCKET_NAME and link S3ConstantsKEY headers or only the link S3ConstantsKEY header. | true | boolean
 | **fileName** (consumer) | To get the object from the bucket with the given file name |  | String
 | **includeBody** (consumer) | If it is true the exchange body will be set to a stream to the contents of the file. If false the headers will be set with the S3 object metadata but the body will be null. This option is strongly related to autocloseBody option. In case of setting includeBody to true and autocloseBody to false it will be up to the caller to close the S3Object stream. Setting autocloseBody to true will close the S3Object stream automatically. | true | boolean
-| **maxConnections** (consumer) | Set the maxConnections parameter in the S3 client configuration | 50 | int
+| **maxConnections** (consumer) | Set the maxConnections parameter in the S3 client configuration | 60 | int
 | **maxMessagesPerPoll** (consumer) | Gets the maximum number of messages as a limit to poll at each polling. Is default unlimited but use 0 or negative number to disable it as unlimited. | 10 | int
 | **prefix** (consumer) | Camel 2.10.1: The prefix which is used in the com.amazonaws.services.s3.model.ListObjectsRequest to only consume objects we are interested in. |  | String
 | **sendEmptyMessageWhenIdle** (consumer) | If the polling consumer did not poll any files you can enable this option to send an empty message (no body) instead. | false | boolean

http://git-wip-us.apache.org/repos/asf/camel/blob/8163a8f0/components/camel-aws/src/main/java/org/apache/camel/component/aws/s3/S3Configuration.java
----------------------------------------------------------------------
diff --git a/components/camel-aws/src/main/java/org/apache/camel/component/aws/s3/S3Configuration.java b/components/camel-aws/src/main/java/org/apache/camel/component/aws/s3/S3Configuration.java
index 7cf7fb3..bd26cea 100644
--- a/components/camel-aws/src/main/java/org/apache/camel/component/aws/s3/S3Configuration.java
+++ b/components/camel-aws/src/main/java/org/apache/camel/component/aws/s3/S3Configuration.java
@@ -66,8 +66,6 @@ public class S3Configuration implements Cloneable {
     private S3Operations operation;
     @UriParam(label = "consumer", defaultValue = "true")
     private boolean autocloseBody = true;
-    @UriParam(label = "consumer", defaultValue = "50")
-    private int maxConnections = 50;
 
     public long getPartSize() {
         return partSize;
@@ -313,17 +311,6 @@ public class S3Configuration implements Cloneable {
         this.autocloseBody = autocloseBody;
     }
 
-    public int getMaxConnections() {
-        return maxConnections;
-    }
-
-    /**
-     * Set the maxConnections parameter in the S3 client configuration
-     */
-    public void setMaxConnections(int maxConnections) {
-        this.maxConnections = maxConnections;
-    }
-
     boolean hasProxyConfiguration() {
         return ObjectHelper.isNotEmpty(getProxyHost()) && ObjectHelper.isNotEmpty(getProxyPort());
     }

http://git-wip-us.apache.org/repos/asf/camel/blob/8163a8f0/components/camel-aws/src/main/java/org/apache/camel/component/aws/s3/S3Endpoint.java
----------------------------------------------------------------------
diff --git a/components/camel-aws/src/main/java/org/apache/camel/component/aws/s3/S3Endpoint.java b/components/camel-aws/src/main/java/org/apache/camel/component/aws/s3/S3Endpoint.java
index 16e74bd..87fb1d5 100644
--- a/components/camel-aws/src/main/java/org/apache/camel/component/aws/s3/S3Endpoint.java
+++ b/components/camel-aws/src/main/java/org/apache/camel/component/aws/s3/S3Endpoint.java
@@ -67,6 +67,8 @@ public class S3Endpoint extends ScheduledPollEndpoint {
     private S3Configuration configuration;
     @UriParam(label = "consumer", defaultValue = "10")
     private int maxMessagesPerPoll = 10;
+    @UriParam(label = "consumer", defaultValue = "60")
+    private int maxConnections = 50 + maxMessagesPerPoll;
 
     @Deprecated
     public S3Endpoint(String uri, CamelContext context, S3Configuration configuration) {
@@ -240,11 +242,11 @@ public class S3Endpoint extends ScheduledPollEndpoint {
             clientConfiguration = new ClientConfiguration();
             clientConfiguration.setProxyHost(configuration.getProxyHost());
             clientConfiguration.setProxyPort(configuration.getProxyPort());
-            clientConfiguration.setMaxConnections(configuration.getMaxConnections());
+            clientConfiguration.setMaxConnections(getMaxConnections());
             isClientConfigFound = true;
         } else {
             clientConfiguration = new ClientConfiguration();
-            clientConfiguration.setMaxConnections(configuration.getMaxConnections());
+            clientConfiguration.setMaxConnections(getMaxConnections());
             isClientConfigFound = true;
         }
         if (configuration.getAccessKey() != null && configuration.getSecretKey() != null) {
@@ -282,4 +284,15 @@ public class S3Endpoint extends ScheduledPollEndpoint {
     public void setMaxMessagesPerPoll(int maxMessagesPerPoll) {
         this.maxMessagesPerPoll = maxMessagesPerPoll;
     }
+    
+    public int getMaxConnections() {
+        return maxConnections;
+    }
+
+    /**
+     * Set the maxConnections parameter in the S3 client configuration
+     */
+    public void setMaxConnections(int maxConnections) {
+        this.maxConnections = maxConnections;
+    }
 }