Return-Path: Delivered-To: apmail-activemq-camel-user-archive@locus.apache.org Received: (qmail 89746 invoked from network); 19 Sep 2007 06:01:05 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 19 Sep 2007 06:01:05 -0000 Received: (qmail 18195 invoked by uid 500); 19 Sep 2007 06:00:57 -0000 Delivered-To: apmail-activemq-camel-user-archive@activemq.apache.org Received: (qmail 18185 invoked by uid 500); 19 Sep 2007 06:00:57 -0000 Mailing-List: contact camel-user-help@activemq.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: camel-user@activemq.apache.org Delivered-To: mailing list camel-user@activemq.apache.org Delivered-To: moderator for camel-user@activemq.apache.org Received: (qmail 89540 invoked by uid 99); 18 Sep 2007 16:31:09 -0000 X-ASF-Spam-Status: No, hits=1.2 required=10.0 tests=SPF_NEUTRAL X-Spam-Check-By: apache.org Received-SPF: neutral (athena.apache.org: 88.86.107.6 is neither permitted nor denied by domain of mn@email.cz) X-Virus-Scanned: Debian amavisd-new at procompcz.net Message-ID: <46EFFD2C.4050902@email.cz> Date: Tue, 18 Sep 2007 18:30:36 +0200 From: =?ISO-8859-1?Q?Martin_Nov=E1k?= User-Agent: Thunderbird 2.0.0.6 (Macintosh/20070807) MIME-Version: 1.0 To: camel-user@activemq.apache.org Subject: Re: Combining patterns References: <46EFCAFB.4010300@martinnovak.eu> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 8bit X-Virus-Checked: Checked by ClamAV on apache.org Thanks a lot for pointing this out. However, it doesn't solve my problem, because I want to gather the output of a,b,c into one message, and send it back to the client. The call (template.send(...)) is returned before aggregator can aggregate them, and send them back. Martin Guillaume Nodet wrote: > If you want to send messages to multiple destinations, you should > use multicast(a, b, c) instead of to(a, b, c). The latest means that the > output of a will be sent to b, the output of b to c and the output of c back > to the consumer. This is equivalent to to(a).to(b).to(c) > > On 9/18/07, Martin Nov�k wrote: >> Hello, I have a quite basic problem which I cannot solve. The thing is >> that I want to send message to couple of services. These services should >> be invoked from multiple threads because the processing will take quite >> some time. Then I want to gather, and aggregate the output of the >> services somehow nicely, and return it to the calling point. >> >> I was trying to use seda with combination with aggregator, which worked >> up to the point that it returned just the first message to the user - >> before aggregator was able to process the rest. I know that the whole >> service is asynchronous by my design, but it would be nice to know how >> to gather the results back... >> >> there is an excerpt from my code - just an illustation: >> >> from("direct:a").setHeader("splitCount", new Expression() { >> public Object evaluate(Exchange exchange) { >> return 2; >> }}).to("seda:b", "seda:c"); >> from("seda:b").process(new HeaderSetter("msgCounter", >> 0)).process(traceProcessor).to("ret:xxx").to("seda:z"); >> from("seda:c").process(new HeaderSetter("msgCounter", >> 1)).process(traceProcessor).to("ret:xxx").to("seda:z"); >> from("seda:z").aggregator(header("msgId"), >> aggregationStrategy).to("return:a"); >> >> Exchange exchange = new DefaultExchange(ctx); >> exchange.getIn().setBody(""); >> exchange.getIn().setHeader("msgId", "ahojValue" + ii); >> exchange = template.send("direct:a", exchange); >> Object body = exchange.getOut().getBody(); >> >> can somebody advice me what to do please? >> thanks, >> Martin >> > > >