Reputation: 3648
I am trying to using property placeholder in camel route. I have test.properties which define property: MQ.queuename1=TESTQUEUE. In camel context, i define placeholder:
<camel:camelContext xmlns="http://camel.apache.org/schema/spring" >
<propertyPlaceholder id="camel-properties" location="file:${web.external.propdir}/test.properties"/>
In the route, i use simple expresion to evaluate the property:
<choice>
<when>
<simple>${in.header.queuename} == '{{MQ.queuename1}}'</simple>
<bean ref="ExtractOrderContent" method="extractContent"/>
<to uri="websphere-mq:queue:TESTQUEUE" pattern="InOnly"/>
</when>
</choice>
When i run camel, the property file is recognized by camel but it looks like the simple expression doesn't work. Do i miss anything?
Upvotes: 4
Views: 24753
Reputation: 55760
You can use the properties function from simple (http://camel.apache.org/simple)
<simple>${in.header.queuename} == ${properties:MQ.queuename1}</simple>
The {{ }} in nested < when > is likely due to a bug, that has been fixed in newer Camel releases.
Upvotes: 14
Reputation: 1376
From the route configuration that you have provided, It seems that you missed out setting queuename in header. Instead you should use properties component as
<simple>${properties:queuename} == 'MQ.queuename1'</simple>
Upvotes: 2