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/01/20 12:19:05 UTC

[1/3] camel git commit: CAMEL-10729: Camel-AWS: S3 autocloseBody option

Repository: camel
Updated Branches:
  refs/heads/camel-2.18.x 2e716342c -> 2dae076dd


CAMEL-10729: Camel-AWS: S3 autocloseBody option


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

Branch: refs/heads/camel-2.18.x
Commit: 3158579fb2e94195e570460d81e3096510cf2a06
Parents: 2e71634
Author: Andrea Cosentino <an...@gmail.com>
Authored: Fri Jan 20 12:53:55 2017 +0100
Committer: Andrea Cosentino <an...@gmail.com>
Committed: Fri Jan 20 13:15:54 2017 +0100

----------------------------------------------------------------------
 .../camel/component/aws/s3/S3Configuration.java      | 15 +++++++++++++++
 .../apache/camel/component/aws/s3/S3Endpoint.java    | 13 +++++++++++++
 2 files changed, 28 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/3158579f/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 d25d0da..aafec13 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
@@ -64,6 +64,8 @@ public class S3Configuration implements Cloneable {
     private boolean pathStyleAccess;
     @UriParam(label = "producer", enums = "copyObject,deleteBucket,listBuckets")
     private S3Operations operation;
+    @UriParam(label = "consumer", defaultValue = "true")
+    private boolean autocloseBody = true;
 
     public long getPartSize() {
         return partSize;
@@ -294,7 +296,20 @@ public class S3Configuration implements Cloneable {
         this.operation = operation;
     }
 
+    public boolean isAutocloseBody() {
+        return autocloseBody;
+    }
+
+    /**
+     * If this option is true and includeBody is true, then the S3Object.close() method will be called on exchange completion
+     */
+    public void setAutocloseBody(boolean autocloseBody) {
+        this.autocloseBody = autocloseBody;
+    }
+
     boolean hasProxyConfiguration() {
         return ObjectHelper.isNotEmpty(getProxyHost()) && ObjectHelper.isNotEmpty(getProxyPort());
     }
+    
+    
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/camel/blob/3158579f/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 038bc91..05a61f4 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
@@ -43,6 +43,7 @@ import org.apache.camel.spi.Metadata;
 import org.apache.camel.spi.UriEndpoint;
 import org.apache.camel.spi.UriParam;
 import org.apache.camel.spi.UriPath;
+import org.apache.camel.support.SynchronizationAdapter;
 import org.apache.camel.util.ObjectHelper;
 
 import org.slf4j.Logger;
@@ -191,6 +192,18 @@ public class S3Endpoint extends ScheduledPollEndpoint {
                 s3Object.close();
             } catch (IOException e) {
             }
+        } else {
+            if (configuration.isAutocloseBody()) {
+                exchange.addOnCompletion(new SynchronizationAdapter() {
+                    @Override
+                    public void onDone(Exchange exchange) {
+                        try {
+                            s3Object.close();
+                        } catch (IOException e) {
+                        }
+                    }
+                });
+            }
         }
 
         return exchange;


[2/3] camel git commit: CAMEL-10729: Fixed test

Posted by ac...@apache.org.
CAMEL-10729: Fixed test


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

Branch: refs/heads/camel-2.18.x
Commit: 68e37562e21e2c03e01a76841596a4e7ac81ee8c
Parents: 3158579
Author: Andrea Cosentino <an...@gmail.com>
Authored: Fri Jan 20 13:05:27 2017 +0100
Committer: Andrea Cosentino <an...@gmail.com>
Committed: Fri Jan 20 13:16:06 2017 +0100

----------------------------------------------------------------------
 .../org/apache/camel/component/aws/s3/S3ComponentFileTest.java     | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/68e37562/components/camel-aws/src/test/java/org/apache/camel/component/aws/s3/S3ComponentFileTest.java
----------------------------------------------------------------------
diff --git a/components/camel-aws/src/test/java/org/apache/camel/component/aws/s3/S3ComponentFileTest.java b/components/camel-aws/src/test/java/org/apache/camel/component/aws/s3/S3ComponentFileTest.java
index 445abca..b32f3c9 100644
--- a/components/camel-aws/src/test/java/org/apache/camel/component/aws/s3/S3ComponentFileTest.java
+++ b/components/camel-aws/src/test/java/org/apache/camel/component/aws/s3/S3ComponentFileTest.java
@@ -88,7 +88,7 @@ public class S3ComponentFileTest extends CamelTestSupport {
 
         assertMockEndpointsSatisfied();
 
-        assertResultExchange(result.getExchanges().get(0), false);
+        assertResultExchange(result.getExchanges().get(0), true);
 
         PutObjectRequest putObjectRequest = client.putObjectRequests.get(0);
         assertEquals(getCamelBucket(), putObjectRequest.getBucketName());


[3/3] camel git commit: CAMEL-10729: Regen docs

Posted by ac...@apache.org.
CAMEL-10729: Regen docs


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

Branch: refs/heads/camel-2.18.x
Commit: 2dae076ddb766b0ffd40b0fd14a1d571f6ee5cf3
Parents: 68e3756
Author: Andrea Cosentino <an...@gmail.com>
Authored: Fri Jan 20 13:18:35 2017 +0100
Committer: Andrea Cosentino <an...@gmail.com>
Committed: Fri Jan 20 13:18:35 2017 +0100

----------------------------------------------------------------------
 components/camel-aws/src/main/docs/aws-s3-component.adoc | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/2dae076d/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 8c2a106..da57469 100644
--- a/components/camel-aws/src/main/docs/aws-s3-component.adoc
+++ b/components/camel-aws/src/main/docs/aws-s3-component.adoc
@@ -46,7 +46,7 @@ The AWS S3 Storage Service component has no options.
 
 
 // endpoint options: START
-The AWS S3 Storage Service component supports 40 endpoint options which are listed below:
+The AWS S3 Storage Service component supports 41 endpoint options which are listed below:
 
 {% raw %}
 [width="100%",cols="2,1,1m,1m,5",options="header"]
@@ -61,6 +61,7 @@ The AWS S3 Storage Service component supports 40 endpoint options which are list
 | proxyHost | common |  | String | Camel 2.16: To define a proxy host when instantiating the SQS client
 | proxyPort | common |  | Integer | Camel 2.16: Specify a proxy port to be used inside the client definition.
 | secretKey | common |  | String | Amazon AWS Secret Key
+| autocloseBody | consumer | true | boolean | If this option is true and includeBody is true then the S3Object.close() method will be called on exchange completion
 | bridgeErrorHandler | consumer | false | boolean | Allows for bridging the consumer to the Camel routing Error Handler which mean any exceptions occurred while the consumer is trying to pickup incoming messages or the likes will now be processed as a message and handled by the routing Error Handler. By default the consumer will use the org.apache.camel.spi.ExceptionHandler to deal with exceptions that will be logged at WARN/ERROR level and ignored.
 | deleteAfterRead | consumer | true | boolean | 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.
 | fileName | consumer |  | String | To get the object from the bucket with the given file name