Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to make camel simple expression work with property placeholder in spring xml

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?

like image 226
David Avatar asked Dec 07 '22 03:12

David


1 Answers

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.

like image 149
Claus Ibsen Avatar answered Jan 03 '23 19:01

Claus Ibsen