2017-10-16 115 views
0

我想讀取屬性的整數值,但我收到錯誤。 我讀過鏈接http://camel.apache.org/properties.html的「在XML DSL中使用屬性佔位符來表示任何屬性」。但我不明白它在文件uri組件中的用法。阿帕奇駱駝:如何讀取文件中的整數屬性uri組件

<from id="listenIncomingFiles" uri="file:{{PFlowIn_AEROW}}?include=.*\.xml&amp;prop:delay={{PFlowScanDelay}}&amp;noop=false&amp;preMove={{PMessDir}}"/> 

Failed to create route .... because of Failed to resolve endpoint: file://D:/data/AeroW/OUT?include=.*\.xml&noop=false&preMove=D%3A%2Fdata%2FMessageDir&prop%3Adelay=2000 due to: Failed to resolve endpoint: file://D:/data/AeroW/OUT?include=.*\.xml&noop=false&preMove=D%3A%2Fdata%2FMessageDir&prop%3Adelay=2000 due to: There are 1 parameters that couldn't be set on the endpoint. Check the uri if the parameters are spelt correctly and that they are properties of the endpoint. Unknown parameters=[{prop:delay=2000}] 

請指導。

回答

1

你可以嘗試

<from id="listenIncomingFiles" uri="file:{{PFlowIn_AEROW}}?include=.*\.xml&amp;delay={{PFlowScanDelay}}&amp;noop=false&amp;preMove={{PMessDir}}"/> 

,而不是

<from id="listenIncomingFiles" uri="file:{{PFlowIn_AEROW}}?include=.*\.xml&amp;prop:delay={{PFlowScanDelay}}&amp;noop=false&amp;preMove={{PMessDir}}"/> 

即 「道具:延遲= {{PFlowScanDelay}}」 應改爲 「延遲= {{PFlowScanDelay}}」 所取代。設置消費者屬性時,不需要「prop:」前綴。

+0

我在IDE中得到編譯時錯誤「參數延遲需要一個數值。」 –

+0

這只是你的IDE抱怨嗎?如果是這樣,你可以忽略它。如果你只是想在你的端點URI中注入屬性,我建議你使用Property place holder http://camel.apache.org/using-propertyplaceholder.html。 如果這仍然無法工作,你可以分享你的配置文件或小項目? – jpoth

+0

是的,它的抱怨和我已閱讀您提供的鏈接中的「在XML DSL中使用任何屬性的屬性佔位符」一節。但它還沒有工作。 –