I have a rest api using apache camel. When I hit a post request on a route, it should get a file from S3 and send the contents of the file as a response back. I am sending json data(filename, bucketName, accesskey, secretkey, region) in order to extract the file from s3. I am able to extract the file but I don't know how to send the contents of the file back as a response. As of now, I am able to download it to my local directory.
public static class HelloRoute extends RouteBuilder {
@Override
public void configure() {
rest("/")
.post("file-from-s3")
.route()
.setHeader(AWS2S3Constants.KEY, constant("filename"))
.to("aws2-s3://bucketnameaccessKey=INSERT&secretKey=INSERT®ion=INSERT&operation=getObject")
.to("file:/tmp/")
.endRest();
}
Now instead of the .to("file:/tmp/")
I want to send the contents of the file as a response back. How can I do this in apache camel?