Pau*_*ulP 0 routes file apache-camel
看似简单,但我不能让它工作.我想要做的是获取放置在"from"路径中的任何文件,修改其内容,并将修改后的文件放在"to"路径中(扩展名为.txt).这就是我所拥有的:
this.context.addRoutes(new RouteBuilder() {
public void configure() {
from( "file:" + getFromPath() + getOptions() )
.to( "file:" + getToPath() + "?fileName=${file:name.noext}.txt")
.process(new Processor() {
public void process(Exchange exchange) throws Exception {
String name = (String) exchange.getIn().getHeader("CamelFileName");
File body = exchange.getIn().getBody(File.class);
String parsedText = modifyFile(body);
exchange.getOut().setBody(parsedText);
}
})
;}
});
Run Code Online (Sandbox Code Playgroud)
输出文件正在创建,但内容与输入文件完全相同.即,文件未被修改.我确认"modifyFile"方法正在返回我想要的内容,但无法将它们写入输出("to")路径.
谢谢您的帮助!
归档时间: |
|
查看次数: |
1357 次 |
最近记录: |