[英]Taking input from multiple files to a camel route
I want to write a camel route which will take input from multiple file destination and process them after aggregating.我想编写一个骆驼路线,它将从多个文件目的地获取输入并在聚合后处理它们。 is it possible to take input from multiple files for a single route?
是否可以从多个文件中获取单个路由的输入?
Yes you can use poll-enrich to call consumer-endpoints like file to enrich the message.是的,您可以使用poll-enrich来调用像文件这样的消费者端点来丰富消息。 This works for many other consumer-endpoints as well like SFTP or message queues.
这适用于许多其他消费者端点以及 SFTP 或消息队列。
If you need to read same file multiple times it can get trickier as you'll likely have to set noop=true and possibly use something like dummy idempotent repository to get around camels default behavior.如果您需要多次读取同一个文件,它可能会变得更加棘手,因为您可能必须设置 noop=true 并且可能使用虚拟幂等存储库之类的东西来绕过骆驼的默认行为。
Note that calling pollEnrich seems to clear headers / create new message so use exchange properties to persist data between pollEnrich calls.请注意,调用 pollEnrich 似乎会清除标题/创建新消息,因此请使用交换属性在 pollEnrich 调用之间保留数据。
from("file:someDirectory")
.setProperty("file1").body()
.pollEnrich("file:otherDirectory", 3000)
.setProperty("file2").body()
.pollEnrich("file:yetAnotherDirectory", 3000)
.setProperty("file3").body();
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.