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: Passing parameter values to bean methods via spring
Date Wed, 01 Feb 2012 08:20:24 GMT
Hi

On Tue, Jan 31, 2012 at 5:10 PM, Gershaw, Geoffrey
<geoffrey.gershaw@credit-suisse.com> wrote:
> Hello,
>
>
>
> I am a newbie to Camel. I've read a bunch of docs, but have not found an
> answer to this specific use case.
>

Welcome to the community.

>
>
> 1.       Assume the following.
>
> a.       I have the belown XML msg in the body of my Message.
>
> <Example>
>
>                <User>joe</User>
>
> </Example>
>
> b.      I am using a bean as a Filter. The method signature is
>
>                                                          
    i.
> public boolean validateUser(String user)
>
> c.       Ideally I would like to user xpath in the config file to pass
> "Joe" to the validateUser method
>

Yes xpath works fine for grabbing content from a XML doc.
However  where it get tricky is if your XML uses namespaces. If so
your XPath expression *must* also use namespaces.


> d.      If the method returns false, I would like the route to stop.
> Don't know how to do this.
>

You can use a Content Based Router, and in the otherwise leg, you can
use the stop DSL.


> e.      If the method returns true, I would like to pass the original
> XML msg to a processor and finish the route.
>

Yes this happens already, the filter predicate is just for determine
true | false

> f.        Is this possible?
>
>

Yes, something a like

from X
  choice
     when bean (myFilterBean)
       to Y
    otherwise
      stop



>
>
>
> Thanks
>
> Geoff Gershaw
>
>
> ===============================================================================
> Please access the attached hyperlink for an important electronic communications disclaimer:
> http://www.credit-suisse.com/legal/en/disclaimer_email_ib.html
> ===============================================================================
>



-- 
Claus Ibsen
-----------------
FuseSource
Email: cibsen@fusesource.com
Web: http://fusesource.com
Twitter: davsclaus, fusenews
Blog: http://davsclaus.blogspot.com/
Author of Camel in Action: http://www.manning.com/ibsen/

Mime
View raw message