Camel:How 动态替换输出文件路径位置?
Camel:How to substitute output file path location dynamically?
这是我的路线:
<route id="comingFromSomewhere">
<from uri="direct:comingFromSomewhere" ></from>
<process ref="placeHolderProcessor" ></process>
<to uri="file://{{property.FinalPath}}" />
</route>
这是我的处理器:
public class PlaceHolderProcessor implements Processor {
String gerantOutPutFilePath="C:/{clientName}/OUTPUT";
@Override
public void process(Exchange exchange) throws Exception {
String fileName = (String) exchange.getIn().getHeader("CamelFileName");
String clientName= (trioptimaFileName.split("-"))[0].toUpperCase();
String path = gerantOutPutFilePath.replace("{clientName}", clientName);
exchange.setProperty("FinalPath", path);
}
}
当我尝试根据输入文件名动态更改输出路径时。它不适用于 me.Seems,就像问题出在“<to uri="file://{{property.FinalPath}}" />
”,有人可以帮我解决吗??
像这样使用 Camel 的 dynamic message endpoint:
<toD uri="file://${property.FinalPath}/" />
这是我的路线:
<route id="comingFromSomewhere">
<from uri="direct:comingFromSomewhere" ></from>
<process ref="placeHolderProcessor" ></process>
<to uri="file://{{property.FinalPath}}" />
</route>
这是我的处理器:
public class PlaceHolderProcessor implements Processor {
String gerantOutPutFilePath="C:/{clientName}/OUTPUT";
@Override
public void process(Exchange exchange) throws Exception {
String fileName = (String) exchange.getIn().getHeader("CamelFileName");
String clientName= (trioptimaFileName.split("-"))[0].toUpperCase();
String path = gerantOutPutFilePath.replace("{clientName}", clientName);
exchange.setProperty("FinalPath", path);
}
}
当我尝试根据输入文件名动态更改输出路径时。它不适用于 me.Seems,就像问题出在“<to uri="file://{{property.FinalPath}}" />
”,有人可以帮我解决吗??
像这样使用 Camel 的 dynamic message endpoint:
<toD uri="file://${property.FinalPath}/" />