Return-Path: Delivered-To: apmail-activemq-camel-user-archive@locus.apache.org Received: (qmail 2892 invoked from network); 19 Sep 2007 06:31:22 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 19 Sep 2007 06:31:22 -0000 Received: (qmail 34330 invoked by uid 500); 19 Sep 2007 06:31:14 -0000 Delivered-To: apmail-activemq-camel-user-archive@activemq.apache.org Received: (qmail 34314 invoked by uid 500); 19 Sep 2007 06:31:14 -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 Received: (qmail 34305 invoked by uid 99); 19 Sep 2007 06:31:14 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 18 Sep 2007 23:31:14 -0700 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of gnodet@gmail.com designates 209.85.128.188 as permitted sender) Received: from [209.85.128.188] (HELO fk-out-0910.google.com) (209.85.128.188) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 19 Sep 2007 06:31:13 +0000 Received: by fk-out-0910.google.com with SMTP id 18so101224fkq for ; Tue, 18 Sep 2007 23:30:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; bh=7QOysgMQma+f44FdKlmaB+0UlxR/7p/I50g2eavu9j8=; b=ul3XK6gg3Jfg0pLCPdOdSzsy6paveGmQT6J7MO0zNqZRY6xunF75gQNu9YONQN7BvVzIw0Bsigg2976/vY98OTbJUTQejGFEHhGwXMSrA4/g74jASKoa5PrudGzoMNIOO4gTm3/TQGsxObIY+UtepBT7dzOYXz4UwdKGtRNP86w= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=g6wSTC0xUg+Nmja4NDyuckvENCYWQitnVcTxa5BlH1s5Moj28vulRFxq6Gim5II6S4lpygZc/JdBp7q3gvhtKbtM8YyMagVBIHU5To9b46u28EKrdX+KHOWADsxDunXBRuyWvyBwGDqLiMmkWtdYaqjz9cw/R3Sh6OP6BhGdQeg= Received: by 10.82.178.11 with SMTP id a11mr250659buf.1190183451333; Tue, 18 Sep 2007 23:30:51 -0700 (PDT) Received: by 10.82.183.3 with HTTP; Tue, 18 Sep 2007 23:30:51 -0700 (PDT) Message-ID: Date: Wed, 19 Sep 2007 08:30:51 +0200 From: "Guillaume Nodet" To: camel-user@activemq.apache.org Subject: Re: Combining patterns In-Reply-To: <46EFFD2C.4050902@email.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline References: <46EFCAFB.4010300@martinnovak.eu> <46EFFD2C.4050902@email.cz> X-Virus-Checked: Checked by ClamAV on apache.org I think there are two different things here. The first one is to have the aggregator receive, correlate and create the aggregate response. The process of going through a splitter / aggregator pattern, is inherently based on InOnly exchanges. So if you want to have the response synchronously, there is a need for a bridge between an InOut and two InOnly exchanges. I don't think this is supported yet. I guess one way to do that would be to send the response from the aggregator to a seda queue and create a processor that will grab the correct response from this queue, and set it as the out message. Makes sense ? On 9/18/07, Martin Nov=E1k wrote: > 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=E1k 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 shou= ld > >> be invoked from multiple threads because the processing will take quit= e > >> 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 worke= d > >> 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 =3D new DefaultExchange(ctx); > >> exchange.getIn().setBody(""); > >> exchange.getIn().setHeader("msgId", "ahojValue" + ii); > >> exchange =3D template.send("direct:a", exchange); > >> Object body =3D exchange.getOut().getBody(); > >> > >> can somebody advice me what to do please? > >> thanks, > >> Martin > >> > > > > > > > --=20 Cheers, Guillaume Nodet ------------------------ Blog: http://gnodet.blogspot.com/