Is the variable initialized at route construction time?

If yes, you should wrap the isEquals in a constant expression:
constant(isValid.equals(...)).

The simple language wouldn't work because the variable doesn't exist during
the runtime of the route.

If you want to set the isValid depending on a decision evaluated against
the inflight message, e.g. if an XPath condition is true, you should look
into more complex Predicates.

HTH,
Raúl.
On 30 Sep 2013 15:47, "kraythe ." <kray...@gmail.com> wrote:

> Did you try ...
>
> when(simple("${header.isValid} == Yes"))
>
> Look at Simple and other expresision languages. If those fail, use
> predicate builder.
>
> *Robert Simmons Jr. MSc. - Lead Java Architect @ EA*
> *Author of: Hardcore Java (2003) and Maintainable Java (2012)*
> *LinkedIn: **http://www.linkedin.com/pub/robert-simmons/40/852/a39*
>
>
> On Mon, Sep 30, 2013 at 5:22 AM, Claus Ibsen <claus.ib...@gmail.com>
> wrote:
>
> > There is a PredicateBuilder where you can build these kind of predicates.
> >
> > See for example
> > http://www.davsclaus.com/2009/02/apache-camel-and-using-compound.html
> >
> > On Mon, Sep 30, 2013 at 12:13 PM, smehta34 <sachin.meht...@gmail.com>
> > wrote:
> > > Hi,
> > >
> > > I have two Strings which I have to check in choice(). If both equals
> then
> > > route to an endpoint else route to different endpoint. I am stuck as
> > when()
> > > accepts only predicates and I am comparing two strings with equals()
> > method
> > > which returns boolean value. How should I proceed? Any help will be
> > helpful
> > > for me.
> > >
> > > Sample route:
> > > -------------
> > > String isValid = "Y";
> > >
> > > .choice()
> > > .when(isValid.equals("Y")).to(seda:\\)
> > > .when(isValid.equals("N")).to(seda:\\)
> > > .end();
> > >
> > > Regards,
> > > Sachin
> > >
> > >
> > >
> > > --
> > > View this message in context:
> >
> http://camel.465427.n5.nabble.com/Camel-when-with-boolean-parameter-tp5740480.html
> > > Sent from the Camel - Users mailing list archive at Nabble.com.
> >
> >
> >
> > --
> > Claus Ibsen
> > -----------------
> > Red Hat, Inc.
> > Email: cib...@redhat.com
> > Twitter: davsclaus
> > Blog: http://davsclaus.com
> > Author of Camel in Action: http://www.manning.com/ibsen
> >
>

Reply via email to