Apache camel ApacheCamel-如何避免在单一路由中处理目标文件夹中的相同文件
我不熟悉骆驼 规定-Apache camel ApacheCamel-如何避免在单一路由中处理目标文件夹中的相同文件,apache-camel,Apache Camel,我不熟悉骆驼 规定- 文件夹中有4个文件 将文件1复制到目标文件夹 等几分钟 然后将文件2、文件3、文件4复制到目标文件夹中 尝试按以下路线执行此操作 from("file://sourcePath?noop=true&include=.*.xml") .setHeader("myheader", simple("header")) .to("file://destPath")
from("file://sourcePath?noop=true&include=.*.xml")
.setHeader("myheader", simple("header"))
.to("file://destPath")
.process(exchange -> {
Thread.sleep(10000);
})
.to("file://sourcePath?noop=true&include=.*.txt|.*.ts|.*.jpg")
.to("file://destPath")
.process(exchange -> {
Thread.sleep(10000);
})
面临的问题-
我认为如果您想尝试第一个选项,可以使用direct:apachecamel组件将Camel交换传递到第二个路由 请参见下面的工作示例:
from("file://sourcePath?noop=true&include=.*.xml")
.setHeader("myheader", simple("header"))
.to("file://destPath")
.process(exchange -> {
Thread.sleep(10000);
})
.to("direct:secondRoute");
from("direct:secondRoute")
.to("file://sourcePath?noop=true&include=.*.txt|.*.ts|.*.jpg")
.to("file://destPath")
.process(exchange -> {
Thread.sleep(10000);
})
您可以添加FileFilter类吗
public class MyFileFilter implements GenericFileFilter {
public boolean accept(GenericFile pathname) {
// we don't accept any files starting with skip in the name
return !pathname.getFileName().startsWith("skip");
}
}
.至(”file://sourcePath?noop=true&filter=#myFileFilter“此处的任何帮助@Ramin ArabbagheriI都尝试了您的建议,但其行为方式与问题2相同:(