You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by justinblandford <ju...@googlemail.com> on 2013/02/07 12:06:36 UTC
How do you use a blueprint property to control a Simple expression?
Hi,
I have a blueprint property such as :-
<cm:property-placeholder>
<cm:default-properties>
<cm:property name="test.property" value="" />
and have a route like :-
<route id="test" >
<from uri="test.."/>
<choice>
<when>
<simple>{{test.property}} == ''</simple>
do something..
otherwise do something else
However when I run the route I get the error:-
org.apache.camel.language.simple.types.SimpleIllegalSyntaxException:
Unexpected token { at location 0
I've also tried ${test.property} but that doesn't work either. Does anyone
have any idea on how to use this blueprint property in the scenario above?
The test.property may potentially have a value as it can be overriden
externally and I want some conditional processing based on that. I'm using
Camel 2.10.0.
Regards,
Justin
--
View this message in context: http://camel.465427.n5.nabble.com/How-do-you-use-a-blueprint-property-to-control-a-Simple-expression-tp5727101.html
Sent from the Camel - Users mailing list archive at Nabble.com.
Re: How do you use a blueprint property to control a Simple
expression?
Posted by justinblandford <ju...@googlemail.com>.
Great thanks. That worked.
--
View this message in context: http://camel.465427.n5.nabble.com/How-do-you-use-a-blueprint-property-to-control-a-Simple-expression-tp5727101p5727240.html
Sent from the Camel - Users mailing list archive at Nabble.com.
Re: How do you use a blueprint property to control a Simple expression?
Posted by Claus Ibsen <cl...@gmail.com>.
On Thu, Feb 7, 2013 at 12:06 PM, justinblandford
<ju...@googlemail.com> wrote:
> Hi,
>
> I have a blueprint property such as :-
>
> <cm:property-placeholder>
> <cm:default-properties>
> <cm:property name="test.property" value="" />
>
> and have a route like :-
>
> <route id="test" >
> <from uri="test.."/>
> <choice>
> <when>
> <simple>{{test.property}} == ''</simple>
> do something..
> otherwise do something else
>
>
> However when I run the route I get the error:-
> org.apache.camel.language.simple.types.SimpleIllegalSyntaxException:
> Unexpected token { at location 0
>
> I've also tried ${test.property} but that doesn't work either. Does anyone
> have any idea on how to use this blueprint property in the scenario above?
> The test.property may potentially have a value as it can be overriden
> externally and I want some conditional processing based on that. I'm using
> Camel 2.10.0.
>
Ah yeah you may need to upgrade Camel. There was an issue in older
releases where the property placeholders in the expressions/predicates
in the routes was not resolved.
A workaround is to use a simple function to refer to the property. eg
the properties function as shown here:
http://camel.apache.org/simple
<simple>${properties:test.property} == ""</simple>
> Regards,
>
> Justin
>
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/How-do-you-use-a-blueprint-property-to-control-a-Simple-expression-tp5727101.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: How do you use a blueprint property to control a Simple
expression?
Posted by "Walzer, Thomas" <th...@integratix.net>.
It should be possible to use $simple{} in property placeholders, like:
> <cm:property-placeholder>
> <cm:default-properties>
> <cm:property name="test.property" value="$simple{__yourexpression_goes_here__}"/>
and then either:
<when>
{{test.property}}
do something
…
…
or
<when>
<simple>{{test.property}}</simple>
…
...
Sorry, have not tried it & hope this helps,
Thomas.
> " />
Am 07.02.2013 um 12:06 schrieb justinblandford <ju...@googlemail.com>:
> Hi,
>
> I have a blueprint property such as :-
>
> <cm:property-placeholder>
> <cm:default-properties>
> <cm:property name="test.property" value="" />
>
> and have a route like :-
>
> <route id="test" >
> <from uri="test.."/>
> <choice>
> <when>
> <simple>{{test.property}} == ''</simple>
> do something..
> otherwise do something else
>
>
> However when I run the route I get the error:-
> org.apache.camel.language.simple.types.SimpleIllegalSyntaxException:
> Unexpected token { at location 0
>
> I've also tried ${test.property} but that doesn't work either. Does anyone
> have any idea on how to use this blueprint property in the scenario above?
> The test.property may potentially have a value as it can be overriden
> externally and I want some conditional processing based on that. I'm using
> Camel 2.10.0.
>
> Regards,
>
> Justin
>
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/How-do-you-use-a-blueprint-property-to-control-a-Simple-expression-tp5727101.html
> Sent from the Camel - Users mailing list archive at Nabble.com.