I currently have the following camel route:
//Only continue to next route if success
from("file:///tmp/camel/input")
.routeId("Test Route")
.to("file:///tmp/camel/test")
.onCompletion().onCompleteOnly()
.log("Success for file: ${header.CamelFileName}")
.setHeader("recipientList", constant("file:///tmp/camel/output, file:///tmp/camel/output2"))
.recipientList(header("recipientList"))
.end();
Need to send a file to recipients only if the previous route was successful.
However, while running the route I came to the conclusion that the .to in the onCompletion() block also reads from the input folder, but the files are already gone, so it can't pick them up and write them to the recipients. (I can't set noop=true at the from, since I do want the files gone after sending them to the recipients...)
So how would we route the file to the recipients, having a successful previous route as prerequisite?