我試圖通過屬性值動態地將傳遞給URI值。該屬性值將在cfg文件中進行配置。基於文件名/ cfg文件/屬性名稱的動態URI
當使用CamelFileNameOnly頭提取文件名時,它必須傳遞到to Uri端點。因此代碼中提到了同一個名字。
請在下面找到我的代碼:
我在我的服務器位置= d下降與名KevinFile.txt文件:\服務器\ jboss的熔絲,6.2.0.redhat-133 \ DATA \ myLocalFTP(文件://數據/ myLocalFTP)
配置文件
local.folder.url=file://data/myLocalFTP
KevinFile=file://data/KevinFileDirectory
駱駝路線
<route id="awsRoute">
<from uri="{{local.folder.url}}"/>
<bean ref="processorClass" method="process"/>
<log message="myProperty value is ${exchangeProperty.myProperty}"/> <---Gives the fileName
<to uri="{{${exchangeProperty.myProperty}}}"/> <--This is the spot i am getting error :(
</route>
ProcessorClass.java
public class ProcessorClass implements Processor{
@Override
public void process(Exchange exchange) throws Exception {
String fileName = (String) exchange.getIn().getHeader("CamelFileNameOnly");
exchange.setProperty("myPropertyNew", fileName);
}
}
凱文,我很困惑與你試圖完成什麼都可以嘗試,以提高描述了一下,重點是你的目標是什麼? –
您好Mathew,我需要傳遞「uri」組件中的Propery「文件名」,以便它將引用具有相似名稱的cfg文件並將文件放在指定位置。 –