骆驼:如何动态替换输出文件路径位置?



这是我的路线:

<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);
}
}

当我尝试根据输入文件名动态更改输出路径时。它对我不起作用。似乎问题在"<to uri="file://{{property.FinalPath}}" />' 任何人都可以帮我解决吗?

像这样使用 Camel 的动态消息端点:

<toD uri="file://${property.FinalPath}/" />

最新更新