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/04/12 14:05:42 UTC

[camel] branch master updated: CAMEL-12437 - Ability to define dynamic bucket name for s3 router using standard S3Constants.BUCKET_NAME supplied in header

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


The following commit(s) were added to refs/heads/master by this push:
     new f3a1e69  CAMEL-12437 - Ability to define dynamic bucket name for s3 router using standard S3Constants.BUCKET_NAME supplied in header
f3a1e69 is described below

commit f3a1e69682b5c660ead1a94ac27c958e056cd15c
Author: Laptseu <al...@Alexs-MacBook-Pro.local>
AuthorDate: Thu Apr 12 22:28:46 2018 +1000

    CAMEL-12437 - Ability to define dynamic bucket name for s3 router using standard S3Constants.BUCKET_NAME supplied in header
---
 .../main/java/org/apache/camel/component/aws/s3/S3Producer.java    | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/components/camel-aws/src/main/java/org/apache/camel/component/aws/s3/S3Producer.java b/components/camel-aws/src/main/java/org/apache/camel/component/aws/s3/S3Producer.java
index df6e1c3..2efb990 100644
--- a/components/camel-aws/src/main/java/org/apache/camel/component/aws/s3/S3Producer.java
+++ b/components/camel-aws/src/main/java/org/apache/camel/component/aws/s3/S3Producer.java
@@ -228,7 +228,12 @@ public class S3Producer extends DefaultProducer {
             is = new ByteArrayInputStream(baos.toByteArray());
         }
 
-        putObjectRequest = new PutObjectRequest(getConfiguration().getBucketName(), determineKey(exchange), is, objectMetadata);
+        String bucketName = exchange.getIn().getHeader(S3Constants.BUCKET_NAME, String.class);
+        if (bucketName == null){
+            LOG.trace("Bucket name is not in header, using default one  [{}]...", getConfiguration().getBucketName());
+            bucketName = getConfiguration().getBucketName();
+        }
+        putObjectRequest = new PutObjectRequest(bucketName, determineKey(exchange), is, objectMetadata);
 
         String storageClass = determineStorageClass(exchange);
         if (storageClass != null) {

-- 
To stop receiving notification emails like this one, please contact
acosentino@apache.org.