2017-05-25 72 views
0

我对形式的骆驼代码片段:不能从性质completionInterval属性(总标记的)分配值文件:骆驼

<aggregate strategyRef="aggregationStrategy" 
    completionSize="50" completionInterval="120000"> 
... 
</aggregate> 

我想通过以下来读取属性文件的属性值链接http://camel.apache.org/properties.html

目前,我已经定义了propertyPlaceholder,通过它我可以通过属性为完成大小(通过引用它通过端点)分配值;如下

<propertyPlaceholder id="properties" location="classpath:file.properties" /> 
<endpoint id="compSize" uri="{{completion.size}}" /> 
... 

<aggregate strategyRef="aggregationStrategy" 
     completionInterval="120000"> 
    ... 
    <completionSize> 
     <simple>ref:compSize</simple> 
    </completionSize> 
    ... 
</aggregate> 

但是,如果我按照同样的程序(作为的<completionSize>)来设置completionInterval,它抛出一个错误,因为我们没有一个像标签<completionInterval>

有没有办法通过属性文件动态地为completionInterval属性赋值?

回答

0

可以在聚合

<aggregate ...> 

    <completionInterval> 
     <constant>{{somePropertyKeyHere}}</constant> 
    </completionInterval> 

它设置为动态表达式或使用prop命名空间设置值记录在使用属性占位符的XML DSL属性的任何一种部分http://camel.apache.org/using-propertyplaceholder.html