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

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


The following commit(s) were added to refs/heads/master by this push:
     new 55b0326  Proposed fix for CAMEL-14174 (#3333)
55b0326 is described below

commit 55b03267923dbe1cbe3bd946ec9ae41e49386487
Author: Otavio Rodolfo Piske <[email protected]>
AuthorDate: Wed Nov 13 22:01:22 2019 +0100

    Proposed fix for CAMEL-14174 (#3333)
    
    * CAMEL-14174: prevent listing more objects than the value defined in 
maxMessagesPerPoll
    
    * Fix the documentation to match the actual default and behavior
---
 components/camel-aws-s3/src/main/docs/aws-s3-component.adoc    |  2 +-
 .../java/org/apache/camel/component/aws/s3/S3Endpoint.java     |  6 +++---
 .../camel/builder/endpoint/dsl/S3EndpointBuilderFactory.java   | 10 ++++++----
 3 files changed, 10 insertions(+), 8 deletions(-)

diff --git a/components/camel-aws-s3/src/main/docs/aws-s3-component.adoc 
b/components/camel-aws-s3/src/main/docs/aws-s3-component.adoc
index a31c2b2..6dea6aa 100644
--- a/components/camel-aws-s3/src/main/docs/aws-s3-component.adoc
+++ b/components/camel-aws-s3/src/main/docs/aws-s3-component.adoc
@@ -109,7 +109,7 @@ with the following path and query parameters:
 | *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 | 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
+| *maxMessagesPerPoll* (consumer) | Gets the maximum number of messages as a 
limit to poll at each polling. Gets the maximum number of messages as a limit 
to poll at each polling. The default value is 10. Use 0 or a negative number to 
set it as unlimited. | 10 | int
 | *prefix* (consumer) | 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
 | *autocloseBody* (consumer) | If this option is true and includeBody is true, 
then the S3Object.close() method will be called on exchange completion. This 
option is strongly related to includeBody 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
diff --git 
a/components/camel-aws-s3/src/main/java/org/apache/camel/component/aws/s3/S3Endpoint.java
 
b/components/camel-aws-s3/src/main/java/org/apache/camel/component/aws/s3/S3Endpoint.java
index c3b0ef1..edcc3a2 100644
--- 
a/components/camel-aws-s3/src/main/java/org/apache/camel/component/aws/s3/S3Endpoint.java
+++ 
b/components/camel-aws-s3/src/main/java/org/apache/camel/component/aws/s3/S3Endpoint.java
@@ -99,7 +99,7 @@ public class S3Endpoint extends ScheduledPollEndpoint {
         String prefix = getConfiguration().getPrefix();
 
         try {
-            s3Client.listObjects(new ListObjectsRequest(bucketName, prefix, 
null, null, 0));
+            s3Client.listObjects(new ListObjectsRequest(bucketName, prefix, 
null, null, maxMessagesPerPoll));
             LOG.trace("Bucket [{}] already exists", bucketName);
             return;
         } catch (AmazonServiceException ase) {
@@ -224,8 +224,8 @@ public class S3Endpoint extends ScheduledPollEndpoint {
     /**
      * Gets the maximum number of messages as a limit to poll at each polling.
      * <p/>
-     * Is default unlimited, but use 0 or negative number to disable it as
-     * unlimited.
+     * Gets the maximum number of messages as a limit to poll at each polling. 
The
+     * default value is 10. Use 0 or a negative number to set it as unlimited.
      */
     public void setMaxMessagesPerPoll(int maxMessagesPerPoll) {
         this.maxMessagesPerPoll = maxMessagesPerPoll;
diff --git 
a/core/camel-endpointdsl/src/main/java/org/apache/camel/builder/endpoint/dsl/S3EndpointBuilderFactory.java
 
b/core/camel-endpointdsl/src/main/java/org/apache/camel/builder/endpoint/dsl/S3EndpointBuilderFactory.java
index 3d815b1..c07741f 100644
--- 
a/core/camel-endpointdsl/src/main/java/org/apache/camel/builder/endpoint/dsl/S3EndpointBuilderFactory.java
+++ 
b/core/camel-endpointdsl/src/main/java/org/apache/camel/builder/endpoint/dsl/S3EndpointBuilderFactory.java
@@ -380,8 +380,9 @@ public interface S3EndpointBuilderFactory {
         }
         /**
          * 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.
+         * polling. Gets the maximum number of messages as a limit to poll at
+         * each polling. The default value is 10. Use 0 or a negative number to
+         * set it as unlimited.
          * 
          * The option is a: <code>int</code> type.
          * 
@@ -394,8 +395,9 @@ public interface S3EndpointBuilderFactory {
         }
         /**
          * 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.
+         * polling. Gets the maximum number of messages as a limit to poll at
+         * each polling. The default value is 10. Use 0 or a negative number to
+         * set it as unlimited.
          * 
          * The option will be converted to a <code>int</code> type.
          * 

Reply via email to