I want to unzip files whenever a "direct" route is called. The fileName I am getting from some other direct route.
from("direct:unZipFile")
.from("file:C:\\MYFILES\\File\\Unzipped\\?fileName=${header.fileName}&idempotent=true")
.split(new ZipSplitter())
.streaming()
.to("file:C:\\MYFILES\\File\\Unzipped\\")
.split(body().convertToString().tokenize("\n"))
.transform()
.simple("${in.body}")
.end();
Now it is working when I call the direct component but it also keeps on scanning the directory and processes the same file. I understand that the above code allows the trigger from direct as well as file component but I just want it to execute from "direct" component and I can't remove the "file" component as from that only I am reading the file.
You can also try to use pollenrich
from("direct:unZipFile")
.pollEnrich.simple("file:C:\\MYFILES\\File\\Unzipped\\?fileName=${header.fileName}")
.split(new ZipSplitter())
.streaming()
...