You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Willem Jiang <wi...@gmail.com> on 2007/12/20 08:51:40 UTC

How can I get the result from the aggregater point

Hi ,

I have a use case , the router configuration could like this

                from("direct:a").multicast().to("direct:x", "direct:y", 
"direct:z");               

                from("direct:x").process(new 
AppendingProcessor("x")).to("direct:aggregater");
                from("direct:y").process(new 
AppendingProcessor("y")).to("direct:aggregater");
                from("direct:z").process(new 
AppendingProcessor("z")).to("direct:aggregater");
               
                from("direct:aggregater").aggregator(header("cheese"), 
new BodyAggregatingStrategy()).
                         
completedPredicate(header("aggregated").isEqualTo(3)).to("mock:result");

Now I send the message to endpoint "direct:a" and I want to get the 
final result of the processors.
Since I use multicast() in the pipeline and I can't get the right result 
after the hole processes finished like the blew code.

    Exchange exchange = template.send("direct:a", new Processor() {
            public void process(Exchange exchange) {
                Message in = exchange.getIn();
                in.setBody("input");
                in.setHeader("foo", "bar");
            }
        });

Is there a way to get the result from the sending point or some other place?

Thanks,

Willem.



Re: How can I get the result from the aggregater point

Posted by Willem Jiang <wi...@gmail.com>.
Hi  Roman,

Thank you for your reply.
We are in the same board now, I just went through your patch and it can 
also fix my issue.

BTW
Do you have a chance to think about using thread pool to improve the 
processor's performance ?

Cheers,

Willem.

Roman Kalukiewicz wrote:
> Hello Willem,
>
> Maybe what we need here is multicaster/aggregator scenario similar to
> what I did lately with splitter/aggregator at
> https://issues.apache.org/activemq/browse/CAMEL-260
>
> In my scenario the same splitter (works in 'InOut mode') splits
> messages and then aggregates results. Basically MulticastProcessor
> could do the same thing with responses it receives, and we could
> create some base class that does it.
>
> Maybe lets create an issue for this problem?
>
> I'm afraid that at the moment Camel cannot handle the solution you
> propose (correct me if I'm wrong guys ;) ).
>
> Roman
>
> 2007/12/20, Willem Jiang <wi...@gmail.com>:
>   
>> Hi ,
>>
>> I have a use case , the router configuration could like this
>>
>>                 from("direct:a").multicast().to("direct:x", "direct:y",
>> "direct:z");
>>
>>                 from("direct:x").process(new
>> AppendingProcessor("x")).to("direct:aggregater");
>>                 from("direct:y").process(new
>> AppendingProcessor("y")).to("direct:aggregater");
>>                 from("direct:z").process(new
>> AppendingProcessor("z")).to("direct:aggregater");
>>
>>                 from("direct:aggregater").aggregator(header("cheese"),
>> new BodyAggregatingStrategy()).
>>
>> completedPredicate(header("aggregated").isEqualTo(3)).to("mock:result");
>>
>> Now I send the message to endpoint "direct:a" and I want to get the
>> final result of the processors.
>> Since I use multicast() in the pipeline and I can't get the right result
>> after the hole processes finished like the blew code.
>>
>>     Exchange exchange = template.send("direct:a", new Processor() {
>>             public void process(Exchange exchange) {
>>                 Message in = exchange.getIn();
>>                 in.setBody("input");
>>                 in.setHeader("foo", "bar");
>>             }
>>         });
>>
>> Is there a way to get the result from the sending point or some other place?
>>
>> Thanks,
>>
>> Willem.
>>
>>
>>
>>     
>
>   


Re: How can I get the result from the aggregater point

Posted by Roman Kalukiewicz <ro...@gmail.com>.
Hello Willem,

Maybe what we need here is multicaster/aggregator scenario similar to
what I did lately with splitter/aggregator at
https://issues.apache.org/activemq/browse/CAMEL-260

In my scenario the same splitter (works in 'InOut mode') splits
messages and then aggregates results. Basically MulticastProcessor
could do the same thing with responses it receives, and we could
create some base class that does it.

Maybe lets create an issue for this problem?

I'm afraid that at the moment Camel cannot handle the solution you
propose (correct me if I'm wrong guys ;) ).

Roman

2007/12/20, Willem Jiang <wi...@gmail.com>:
> Hi ,
>
> I have a use case , the router configuration could like this
>
>                 from("direct:a").multicast().to("direct:x", "direct:y",
> "direct:z");
>
>                 from("direct:x").process(new
> AppendingProcessor("x")).to("direct:aggregater");
>                 from("direct:y").process(new
> AppendingProcessor("y")).to("direct:aggregater");
>                 from("direct:z").process(new
> AppendingProcessor("z")).to("direct:aggregater");
>
>                 from("direct:aggregater").aggregator(header("cheese"),
> new BodyAggregatingStrategy()).
>
> completedPredicate(header("aggregated").isEqualTo(3)).to("mock:result");
>
> Now I send the message to endpoint "direct:a" and I want to get the
> final result of the processors.
> Since I use multicast() in the pipeline and I can't get the right result
> after the hole processes finished like the blew code.
>
>     Exchange exchange = template.send("direct:a", new Processor() {
>             public void process(Exchange exchange) {
>                 Message in = exchange.getIn();
>                 in.setBody("input");
>                 in.setHeader("foo", "bar");
>             }
>         });
>
> Is there a way to get the result from the sending point or some other place?
>
> Thanks,
>
> Willem.
>
>
>