camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Brendan Long <bren...@realgo.com>
Subject Re: AWS-Component (S3) => Best way to set the CamelAwsS3Key Header?
Date Mon, 29 Aug 2011 17:47:38 GMT
It doesn't look like there is an automatic way of setting the S3 key, so
I'm not sure why it worked the first time.

I think what you're trying to do would be this:

Message in = exchange.getIn();
in.setHeader(S3Constants.KEY, in.getHeader(Exchange.FILE_NAME));

On 2011-08-29 11:11 AM, megachucky wrote:
> Hello.
>
> Again a question about the AWS component (S3). What is the best way to set
> the CamelAwsS3Key header?
>
> I did it this way:
> from("file:files/inbox").setHeader(S3Constants.KEY, simple("Static
> Key")).......
>
> The test in the source code does this:
>
>         Exchange exchange = template.send("direct:start",
> ExchangePattern.InOut, new Processor() {
>             public void process(Exchange exchange) throws Exception {
>                 exchange.getIn().setHeader(S3Constants.KEY,
> "CamelUnitTest");
>                 exchange.getIn().setBody("This is my bucket content.");
>             }
>
> If the key is null, then the following is called in the camel aws code:
> throw new IllegalArgumentException("AWS S3 Key header missing.");
>
> Thus, I have to set a key (of course it must not be null due to the S3
> service!). 
> Nevertheless, I also managed to do it automatically: In my first try, the
> key was message1.xml and message2.xml -> I did not set a header. The name of
> the files was used.
>
> Unfortunately, I cannot reproduce this. Italways get the exception, if  I do
> not set the header. Can you please help me out? What is the configuration
> that the header is set automatically?
>
> Thank you...
>
> Best regards,
> Kai
>        
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/AWS-Component-S3-Best-way-to-set-the-CamelAwsS3Key-Header-tp4746938p4746938.html
> Sent from the Camel - Users mailing list archive at Nabble.com.


Mime
View raw message