I need to read a file from S3 bucket based on the file name passed from a REST endpoint. The file name will be passed as a uri parameter. The camel route I am using is given below.
rest().get("/file")
.to("direct:readFile");
from("direct:readFile")
.setProperty("FileName",simple("${header.fileName}"))
.log(LoggingLevel.INFO, "Reading file from S3")
.setHeader(S3Constants.KEY, simple("${header.fileName}"))
.to("aws-s3://"+awsBucket+"?amazonS3Client=#s3Client&fileName=${header.fileName}")
...
Instead of reading the file, this is currently overwriting the existing file in S3 with an empty file. How do I specify that this is a read operation and not a write operation?
I know that the latest version has an operation=getObject
parameter for this. But the version I am using is 2.18.1 as the rest of the application is also on this version, and this version does not support this operation.
Is there any other way to achieve this?