我目前有以下骆驼路线:
//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();
仅当先前的路由成功时才需要向收件人发送文件。
但是,在运行该路线时,我得出的结论是 onCompletion() 块中的 .to 也从输入文件夹中读取,但文件已经消失,因此无法将它们拾取并将它们写入收件人。(我不能在 from 处设置 noop=true,因为我确实希望文件在发送给收件人之后消失......)
那么我们如何将文件路由给收件人,以之前成功的路由为先决条件呢?