You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by martin11 <ma...@gmail.com> on 2012/11/12 10:26:23 UTC

Propery Placeholder within WHEN

Hello,

I`m trying to setup message header with constant from property file. When I
use following XML configuration everything works perfect and I got what I
expected.
<camel:route id="timer-to-ws">     <camel:from
uri="timer://foo?fixedRate=true&amp;amp;period=4s"/>     <camel:setHeader
headerName="x-ssl-certificate">        
<camel:constant>{{property.test.cert}}</camel:constant>    
</camel:setHeader> </camel:route>
Unfortunately I added a condition where I want to chceck if the property
exist and when it exist (is not empty string) then it will be setup in
message header. See my updated context:
<camel:route id="timer-to-ws">     <camel:from
uri="timer://foo?fixedRate=true&amp;amp;period=4s"/>     <camel:when>        
<camel:simple>'{{property.test.cert}}' not regex
'^[\s]*[\s]*$'</camel:simple>         <camel:setHeader
headerName="x-ssl-certificate">            
<camel:constant>{{property.test.cert}}</camel:constant>        
</camel:setHeader>     </camel:when> </camel:route>
Now in message header i got string "{{property.test.cert}}" instead of
string from property files like it was before (previous context). 

*What is bad on using property placeholder inside WHEN clausule? How I
should use it?*

Thank you!



--
View this message in context: http://camel.465427.n5.nabble.com/Propery-Placeholder-within-WHEN-tp5722577.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Propery Placeholder within WHEN

Posted by martin11 <ma...@gmail.com>.
Hi Claus,

your hint with 'simple' really helped me. Thank you for quick answer!



--
View this message in context: http://camel.465427.n5.nabble.com/Propery-Placeholder-within-WHEN-tp5722577p5722582.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Propery Placeholder within WHEN

Posted by Claus Ibsen <cl...@gmail.com>.
On Mon, Nov 12, 2012 at 10:26 AM, martin11 <ma...@gmail.com> wrote:
> Hello,
>
> I`m trying to setup message header with constant from property file. When I
> use following XML configuration everything works perfect and I got what I
> expected.
> <camel:route id="timer-to-ws">     <camel:from
> uri="timer://foo?fixedRate=true&amp;amp;period=4s"/>     <camel:setHeader
> headerName="x-ssl-certificate">
> <camel:constant>{{property.test.cert}}</camel:constant>
> </camel:setHeader> </camel:route>
> Unfortunately I added a condition where I want to chceck if the property
> exist and when it exist (is not empty string) then it will be setup in
> message header. See my updated context:
> <camel:route id="timer-to-ws">     <camel:from
> uri="timer://foo?fixedRate=true&amp;amp;period=4s"/>     <camel:when>
> <camel:simple>'{{property.test.cert}}' not regex
> '^[\s]*[\s]*$'</camel:simple>         <camel:setHeader
> headerName="x-ssl-certificate">
> <camel:constant>{{property.test.cert}}</camel:constant>
> </camel:setHeader>     </camel:when> </camel:route>
> Now in message header i got string "{{property.test.cert}}" instead of
> string from property files like it was before (previous context).
>
> *What is bad on using property placeholder inside WHEN clausule? How I
> should use it?*
>

Please don't post using HTML format. It's not readable for people in
the mailing lists.

You can use the properties function from the simple language
http://camel.apache.org/simple

<camel:simple>'${properties:property.test.cert}' not regex
'^[\s]*[\s]*$'</camel:simple>



> Thank you!
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Propery-Placeholder-within-WHEN-tp5722577.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-----------------
Red Hat, Inc.
FuseSource is now part of Red Hat
Email: cibsen@redhat.com
Web: http://fusesource.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen

Re: Propery Placeholder within WHEN

Posted by martin11 <ma...@gmail.com>.
Sorry for this missing information.
I`m using Camel 2.10.2



--
View this message in context: http://camel.465427.n5.nabble.com/Propery-Placeholder-within-WHEN-tp5722577p5722579.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Propery Placeholder within WHEN

Posted by Claus Ibsen <cl...@gmail.com>.
Hi

What version of Camel are you using?


On Mon, Nov 12, 2012 at 10:26 AM, martin11 <ma...@gmail.com> wrote:
> Hello,
>
> I`m trying to setup message header with constant from property file. When I
> use following XML configuration everything works perfect and I got what I
> expected.
> <camel:route id="timer-to-ws">     <camel:from
> uri="timer://foo?fixedRate=true&amp;amp;period=4s"/>     <camel:setHeader
> headerName="x-ssl-certificate">
> <camel:constant>{{property.test.cert}}</camel:constant>
> </camel:setHeader> </camel:route>
> Unfortunately I added a condition where I want to chceck if the property
> exist and when it exist (is not empty string) then it will be setup in
> message header. See my updated context:
> <camel:route id="timer-to-ws">     <camel:from
> uri="timer://foo?fixedRate=true&amp;amp;period=4s"/>     <camel:when>
> <camel:simple>'{{property.test.cert}}' not regex
> '^[\s]*[\s]*$'</camel:simple>         <camel:setHeader
> headerName="x-ssl-certificate">
> <camel:constant>{{property.test.cert}}</camel:constant>
> </camel:setHeader>     </camel:when> </camel:route>
> Now in message header i got string "{{property.test.cert}}" instead of
> string from property files like it was before (previous context).
>
> *What is bad on using property placeholder inside WHEN clausule? How I
> should use it?*
>
> Thank you!
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Propery-Placeholder-within-WHEN-tp5722577.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-----------------
Red Hat, Inc.
FuseSource is now part of Red Hat
Email: cibsen@redhat.com
Web: http://fusesource.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen