Return-Path: Delivered-To: apmail-camel-users-archive@www.apache.org Received: (qmail 73143 invoked from network); 16 Jun 2009 08:36:01 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 16 Jun 2009 08:36:01 -0000 Received: (qmail 31978 invoked by uid 500); 16 Jun 2009 08:36:12 -0000 Delivered-To: apmail-camel-users-archive@camel.apache.org Received: (qmail 31906 invoked by uid 500); 16 Jun 2009 08:36:12 -0000 Mailing-List: contact users-help@camel.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: users@camel.apache.org Delivered-To: mailing list users@camel.apache.org Received: (qmail 31893 invoked by uid 99); 16 Jun 2009 08:36:12 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 16 Jun 2009 08:36:12 +0000 X-ASF-Spam-Status: No, hits=2.2 required=10.0 tests=HTML_MESSAGE,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of cmoulliard@gmail.com designates 209.85.220.207 as permitted sender) Received: from [209.85.220.207] (HELO mail-fx0-f207.google.com) (209.85.220.207) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 16 Jun 2009 08:35:59 +0000 Received: by fxm3 with SMTP id 3so1952023fxm.20 for ; Tue, 16 Jun 2009 01:35:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:content-type; bh=/k8UwjrZ+KcQyCnsrpJUn4dDAXH1F1GuvXTtQGu7YVc=; b=b5lgn6JKoJY6slxSc2LlawVwsPN3ozkmEuH3yrItEYX/F34+BBzpiUaBcMzrRUwuZr kUCe5dga/auIWtdZydrVHk+6jAb9xYdJoLFmls3Uklxl/e6OjLWRCBRuy5QwJ2//Aokh d2WEpIZQGix7xC0USDlO3avDrbWjf9zhc9vD0= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; b=vpyAuW9Vf3GwtuP4F5r4q2D7+zaLHHWxQ8VEfr0EbHjFZnofs+qpjmsZmvOlVfvIeI 4mcoNGZzhlvTfxLLuELCXgM4zAFSXOPD7BcXtD3GjLY0fsNTsAk9IA5k5s6tdFPiL5le 84LxRrr2993aDwLjYmXuKWr154oneksOmjZUg= MIME-Version: 1.0 Received: by 10.103.107.1 with SMTP id j1mr4295103mum.99.1245141339381; Tue, 16 Jun 2009 01:35:39 -0700 (PDT) In-Reply-To: <5380c69c0906150833g2d88d49bv738624edcb9bcf2b@mail.gmail.com> References: <5380c69c0906150833g2d88d49bv738624edcb9bcf2b@mail.gmail.com> Date: Tue, 16 Jun 2009 10:35:39 +0200 Message-ID: Subject: Re: Aggregation error with Spring DSL From: Charles Moulliard To: users@camel.apache.org Content-Type: multipart/alternative; boundary=001636416cf73aa216046c730f77 X-Virus-Checked: Checked by ClamAV on apache.org --001636416cf73aa216046c730f77 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit I have adapted the aggregation strategy of the splitter like this : public Exchange aggregate(Exchange oldExchange, Exchange newExchange) { List requestMessages = new ArrayList(); if (oldExchange == null) { return newExchange; } else { // Get old messages requestMessages = oldExchange.getOut().getBody(List.class); // Get new and add it to the list RequestMessage newReqMessage = newExchange.getOut().getBody( RequestMessage.class); requestMessages.add(newReqMessage); // Add to the exchange oldExchange.getOut().setBody(requestMessages); return newExchange; } } but no ArrayList are propagated after the split(). Where is the issue ? Charles Moulliard Senior Enterprise Architect Apache Camel Committer ***************************** blog : http://cmoulliard.blogspot.com On Mon, Jun 15, 2009 at 5:33 PM, Claus Ibsen wrote: > Hi Charles > > In Camel 2.0 the very first invocation to your aggregate the *old* > exchange is null. > So often you just return the new exchange as you do not have 2 > messages to aggregate. > > if (oldExchange == null) { > return newExchange; > } > > This is changed in Camel 2.0 over 1.x. (eg recently change) > > On Mon, Jun 15, 2009 at 5:31 PM, Charles Moulliard > wrote: > > Hi, > > > > The following error is generated : > > > > Caused by: java.lang.NullPointerException > > at > > > com.xpectis.x3s.core.util.x3sAggregationStrategy.aggregate(x3sAggregationStrategy.java:18) > > at > > > org.apache.camel.processor.MulticastProcessor.doAggregate(MulticastProcessor.java:208) > > at > > > org.apache.camel.processor.MulticastProcessor.doProcessSequntiel(MulticastProcessor.java:190) > > at > > > org.apache.camel.processor.MulticastProcessor.process(MulticastProcessor.java:121) > > at > > > org.apache.camel.processor.interceptor.StreamCachingInterceptor.process(StreamCachingInterceptor.java:52) > > > > with my route : > > > > > class="com.xpectis.x3s.core.util.x3sAggregationStrategy" /> > > > > > > > > > > request.body > > > > > > > method="createRequestMessage"/> > > > > > > > method="validateRequestMessage"/> > > > > > > > method="saveRequestMessage"/> > > > > > > > > public class x3sAggregationStrategy implements AggregationStrategy { > > > > public Exchange aggregate(Exchange oldExchange, Exchange newExchange) > { > > > > List requestMessages = new ArrayList(); > > > > // Get old messages > > requestMessages = oldExchange.getOut().getBody(List.class); // = > > LINE 18 > > > > // Get new and add it to the list > > RequestMessage newReqMessage = > > newExchange.getOut().getBody(RequestMessage.class); > > requestMessages.add(newReqMessage); > > > > // Add to the exchange > > oldExchange.getOut().setBody(requestMessages); > > > > return newExchange; > > > > } > > > > } > > > > I try to collect all the RequestMessage and put it in a collection that I > > will use after the split. How can I do that ? > > > > Regards, > > > > Charles Moulliard > > Senior Enterprise Architect > > Apache Camel Committer > > > > ***************************** > > blog : http://cmoulliard.blogspot.com > > > > > > -- > Claus Ibsen > Apache Camel Committer > > Open Source Integration: http://fusesource.com > Blog: http://davsclaus.blogspot.com/ > Twitter: http://twitter.com/davsclaus > --001636416cf73aa216046c730f77--