【发布时间】:2014-01-25 13:31:05
【问题描述】:
下面列出的代码可以正常工作,但它的功能是查看 XML 文件,如果字段为“我们”,则将其移动到另一个目录;关于使用 .choice() 函数我想了解的内容:
1) 如何指定要路由的特定文件? (将文件名添加到路径末尾不起作用)
2) 如何指定要路由的文件类型? (例如:将所有 .txt 文件路由到“blah”)
3) 除了使用 .choice 之外,还有其他选项可以帮助我做到这一点吗?
CamelContext context = new DefaultCamelContext();
context.addRoutes(new RouteBuilder()
{
public void configure() throws Exception
{
from("file:C:\\camels\\inner?delete=true")
.choice()
.when(xpath("/author/country = 'us'"))
.to("file:C:\\testing");
}
});
context.start();
Thread.sleep(10000);
context.stop();
【问题讨论】:
标签: java routing apache-camel