camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Claus Ibsen <claus.ib...@gmail.com>
Subject Re: Use Properties in a Predicate
Date Thu, 24 Jul 2014 13:29:46 GMT
Use

.when(simple('${properties:comp1URI} != 'DISABLED'))

On Thu, Jul 24, 2014 at 3:23 PM, arnoldmad <arnold@maderthaner.me> wrote:
> Hi !
>
> I'm pretty new to camel and have the following Question:
>
> I have a route that uses multiple different components. based on the
> availability of external systems I might want to use a component or not.
> f.e.
>
> from('direct:startingPoint')
> .to('comp1:callToExternalComp1')
> .to('comp2:callToExternalCom2')
> .to('bean:endPoint')
>
> What I want to do now is replace the hardcoded URIs in the to Java DSL
> functions using PropertyPlaceholder.
> For that I created a PropertyPlaceholder bean and change the route to
> something like this:
>
> from('direct:startingPoint')
> .to('{{comp1URI})
> .to('{{comp2URI')
> .to('bean:endPoint')
>
> Till now everything is fine. My problem starts when I want to do something
> conditional.
> F.e. I want to only call comp1 URI if the URI is set to a real comp1 URI and
> is not disabled in the PropertyPlaceholder file.
> For that I changed the route to something like that:
>
> from('direct:startingPoint')
> .choice()
> .when(simple('${properties:comp1URI}').isNotEqualTo('DISABLED')
> .to('{{comp1URI})
> .otherwise()
> .to('{{comp2URI})
> .end()
>
> here the problem starts as when I call simple() it doesn't find the comp1URI
> property (however if I use it in the to() statement it can find the
> {{comp1URI}}.
>
> What am I doing wrong here or whats the best approach to make a when choice
> based on something set in a properties file ?
>
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Use-Properties-in-a-Predicate-tp5754392.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-----------------
Red Hat, Inc.
Email: cibsen@redhat.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen
hawtio: http://hawt.io/
fabric8: http://fabric8.io/

Mime
View raw message