版本> = 2.16.0中的ToDefinition的Apache Camel getUri

时间:2017-02-21 09:44:41

标签: apache-camel

我有jsut升级了我的骆驼版本,并且在版本2.16.0之前正在运行的一些功能现在已经破坏了,我以前能够获取替换占位符的toDefinition的URI,刚刚升级,现在没有替换占位符。

代码示例如下:

<propertyPlaceholder id="properties" location="config.properties" />

<route>
        <from uri="direct:input" />
        <to uri="mq:queue:{{MY_PLACEHOLDER}}" />
</route>

config.properties

MY_PLACEHOLDER=FOO

Camel版本2.15.5

toDefinition.getUri() // equals mq:queue:FOO

Camel版本2.16.0

toDefinition.getUri() // equals mq:queue:{{MY_PLACEHOLDER}}

有什么想法吗?

1 个答案:

答案 0 :(得分:1)

是的,这就是它的目的。该模型是设计的模型(在这种情况下具有占位符值)。

解决的uri是Camel启动并运行路由的时候。所以你可以拿那个uri,并要求Camel解决,CamelContext上有一个API resolvePropertyPlaceholders

http://static.javadoc.io/org.apache.camel/camel-core/2.18.2/org/apache/camel/CamelContext.html#resolvePropertyPlaceholders-java.lang.String-