You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by ram kumar <ra...@gmail.com> on 2015/06/09 07:13:37 UTC

query file to s3

Hi,

This will write the file present in directory sample to checkoutputdir1
from("file:///home/ram/sample/")
.to("file:///home/ram/checkoutputdir1/");

My use case is to push to s3
from("file:///home/ram/sample/")
.setHeader(S3Constants.KEY, simple("check5"))
.to("aws-s3://camel-qq?accessKey=&secretKey=");

But when i do this, it gets overwritten in 'check5'. Is there a way to get
the exact file name in s3 as present in /home/ram/sample/

Thanks

Re: query file to s3

Posted by Andrew Block <an...@gmail.com>.
Hello,

You can use the File Expression Language [1] to obtain the name of the file and set the appropriate S3 header

For example, if you wanted just the name of the file, you can do the following

from("file:///home/ram/sample/") 
.setHeader(S3Constants.KEY, simple(“file:onlyname.noext")) 
.to("aws-s3://camel-qq?accessKey=&secretKey="); 

- Andy

[1] - http://camel.apache.org/file-language.html
-- 
Andrew Block

On June 9, 2015 at 12:14:26 AM, ram kumar (ramkumarrock3@gmail.com) wrote:

Hi,  

This will write the file present in directory sample to checkoutputdir1  
from("file:///home/ram/sample/")  
.to("file:///home/ram/checkoutputdir1/");  

My use case is to push to s3  
from("file:///home/ram/sample/")  
.setHeader(S3Constants.KEY, simple("check5"))  
.to("aws-s3://camel-qq?accessKey=&secretKey=");  

But when i do this, it gets overwritten in 'check5'. Is there a way to get  
the exact file name in s3 as present in /home/ram/sample/  

Thanks