0

I am using apache camel for this.I have an http server. When I do a get request on a url it should fetch a file from a bucket in aws s3 and then create a file in my local directory.

 public static class HelloRoute extends RouteBuilder {
       
        @Override
        public void configure() {
            rest("/")
                
                .get("file-from-s3")
                    .route()
                    .from("aws2-s3://bucketname?accessKey=INSERT&secretKey=INSERT&region=us-east-1&prefix=hello.txt")
                    .to("file:/tmp/")
                    .endRest();
        }

I wrote the above code for this but it looks like it's ignoring the "from" statement and directly executing the "to" statement and hence creating an empty file in my tmp directory. Is there some other way to do this?

Adi shukla
  • 173
  • 3
  • 11
  • 2
    Use `pollEnrich` to consume from that aws-s3. See the Camel docs about content enricher – Claus Ibsen Jun 29 '20 at 12:21
  • @KavithakaranKanapathippillai for that I will have to add a header for this. I saw that we can do it in this manner ``` .setHeader(S3Constants.KEY,constant("CamelFile"))```. But for aws2 I am not able to locate "S3Constants", could you help me with that? – Adi shukla Jun 29 '20 at 12:23

0 Answers0