2017-10-16 116 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中使用任何属性的属性占位符”一节。但它还没有工作。 –