Is it in purpose you dont have a 2nd transform in the pipeline?


On Mon, Oct 25, 2010 at 12:45 PM, ext2 <[email protected]> wrote:
> Hi:
>
> Here is a simple route,  I think it's result should be  6, but the result is
> 2;
>
>
>
> from("direct:start2").multicast(new SumAggregateBean())
>
>    .pipeline().transform(BeanLanguage.bean(IncreaseOne.class)).bean(new
> IncreaseTwo()).end()
>
>    .pipeline().transform(BeanLanguage.bean(IncreaseOne.class)).bean(new
> IncreaseTwo()).end()
>
> .end()
>
> .to("mock:result2");
>
>
>
>
>
> In this route, IncreaseOne just add the input by one, IncreaseTwo: just add
> the input by two;  The SumAggregateBean just add sum the input integer.
>
> If I send number 0 to the route, I think each pipe line 's result should be
> 0+1+2=3, and final result of route should be 3+3=6; but the result is 2;
>
>
>
> Why? Is it a bug?
>
>
>
> Following is the source code of IncreaseOne, IncreaseTwo, and
> SumAggregateBeans;
>
>
>
>
>
>
>
> public static class IncreaseOne{
>
>       public int increase(int v)
>
>       {
>
>           return v+1;
>
>       }
>
> }
>
> public static class IncreaseTwo{
>
> public int increase(int v) {
>
>           return v+2;
>
> }
>
> }
>
>
>
> public static class SumAggregateBean implements AggregationStrategy{
>
> public Exchange aggregate(Exchange oldExchange, Exchange newExchange) {
>
>    if(oldExchange == null)
>
>       return newExchange;
>
>    int v = parseInt(newExchange.getIn().getBody()) +
>
>        parseInt(oldExchange.getIn().getBody());
>
>    newExchange.getIn().setBody(v);
>
>    return newExchange;
>
> }
>
> }
>
>



-- 
Claus Ibsen
-----------------
FuseSource
Email: [email protected]
Web: http://fusesource.com
Twitter: davsclaus
Blog: http://davsclaus.blogspot.com/
Author of Camel in Action: http://www.manning.com/ibsen/

Reply via email to