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: Splitter with option
Date Mon, 04 Feb 2013 17:24:34 GMT
On Mon, Feb 4, 2013 at 4:35 PM, kikou1984 <hichem.oueslati@atos.net> wrote:
> I tried this one :
>
>
> .split()
> .method(myClass, "methodTosplit")
> .choice().when().simple("${property.CamelSplitIndex} == 2")
>   .bean(myClassA, "methodA")
>  .otherwise()
>    .bean(myClassB, "methodB");
>
>
> it works.
>
> if you got a better idea let me know thxs.
> For each split, the body change by creating a new one, but not the header.
>
> how can i do to reload the header for each split ?
>
> Then i can put : for the fist split headers.put("Array",fistOne") and for
> the second  headers.put("Array",secondOne").
>
> And in the main prog, i can make test,
>
>         .choice().when().simple("${in.header.Array} == fistOne").bean(myClassA,
> "methodA")
>         .otherwise()
>         .bean(myClassB, "methodB");
>

Your splitter bean can return a org.apache.camel.Message. And there
you can add the body, and also add headers such as if you want to call
bean A or bean B afterwards.

An alternative is to have another bean, that figures out to call bean
A or bean B.

 .split()
 .method(myClass, "methodTosplit")
   .bean(myClass, "callAorB")



>
> thxs.
>
>
>
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Splitter-with-option-tp5726900p5726909.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

Mime
View raw message