Try using a bean expression in a choice route

from("direct:start").choice()
  .when().method("myBean", "bodyContainsOne").to("mock:x")
  .otherwise().to("mock:y");

where the bean looks like

static class MyBean {
    public static boolean bodyContainsOne(@Body String messageBody) {
        return messageBody.indexOf("1") >= 0;
    }
}

On Mon, Feb 9, 2009 at 1:06 PM, pevgen <pev...@km.ru> wrote:

>
> Hello.
> How can I create a "content router", if I want to analize a string message
> body.
>
> i try to explain my wish by java-like example :
>
> String messageBody = "test 1";
> if (messageBody.indexOf("1")>=0) then ... messageBody will be sent to an
> "Endpoint1"
> else ...messageBody will be sent to an "Endpoint2".
>
> thanks.
> Evgeny
> --
> View this message in context:
> http://www.nabble.com/content-router-question-tp21916527s22882p21916527.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>
>


-- 
Cheers,
Jon

http://janstey.blogspot.com/

Reply via email to