Return-Path: X-Original-To: apmail-camel-users-archive@www.apache.org Delivered-To: apmail-camel-users-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 6438611B5E for ; Fri, 23 May 2014 13:32:27 +0000 (UTC) Received: (qmail 79326 invoked by uid 500); 23 May 2014 13:32:27 -0000 Delivered-To: apmail-camel-users-archive@camel.apache.org Received: (qmail 79283 invoked by uid 500); 23 May 2014 13:32:27 -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 79275 invoked by uid 99); 23 May 2014 13:32:27 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 23 May 2014 13:32:26 +0000 X-ASF-Spam-Status: No, hits=-0.7 required=5.0 tests=RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of radu.badita@gmail.com designates 209.85.214.175 as permitted sender) Received: from [209.85.214.175] (HELO mail-ob0-f175.google.com) (209.85.214.175) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 23 May 2014 13:32:24 +0000 Received: by mail-ob0-f175.google.com with SMTP id wo20so5352027obc.20 for ; Fri, 23 May 2014 06:32:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=P9p9LTo8QrEHcrKlCxMWUNWKjRC8tDGGsTpAII6+VYI=; b=IQLq28RCBFXo6RXJCbPH40jc+2eoTPzSBKaImt43asdeuHvdKACLLzbyIcBm/cleUH vh9S8y5GboMjO/NmiSIfYdCPh+j+0uUtIAPRcAYmRSraAcg6anni2mmzS7+7IXD20eJ5 aJ7YCaffbPmCa7tANKoaZM2sJjZ6K1bl7Wn29oOt4fPNVOm/o+8f6MMTeYZsTinEPHOm MQngb2BNsJZF966rh3Rf2vPKKePh+qUhevEWDGycDsOhQJg8HXYp/ICB0avSBrrUSKBx dUdiaR7nWZYz1M8VzSvzOODjN+WD7J1va0UAaziE9bS3UAERRBWt0fA5NEsIFIs2yInZ RKDQ== MIME-Version: 1.0 X-Received: by 10.182.76.38 with SMTP id h6mr5060862obw.8.1400851920693; Fri, 23 May 2014 06:32:00 -0700 (PDT) Received: by 10.60.232.43 with HTTP; Fri, 23 May 2014 06:32:00 -0700 (PDT) In-Reply-To: References: Date: Fri, 23 May 2014 16:32:00 +0300 Message-ID: Subject: Re: AggregationStrategyBeanAdapter potential issue when using POJO aggregator and receiving null response From: Radu Badita To: users@camel.apache.org Content-Type: text/plain; charset=UTF-8 X-Virus-Checked: Checked by ClamAV on apache.org Checked the documentation and understood. Basically the attribute AggregationStrategyBeanAdater.allowNullNewExchange has to be true. But it doesn't work since the newExchange is not null, instead only its in-message body is null. Therefore the following: if (!allowNullNewExchange && newExchange == null) { return oldExchange; } is not is not executed and it still continues to attempt to extract and convert the in-body (which fails). On Fri, May 23, 2014 at 4:13 PM, Claus Ibsen wrote: > Hi > > See bottom of this page about no data > http://camel.apache.org/aggregator2 > > On Fri, May 23, 2014 at 3:06 PM, Radu Badita wrote: >> Thanks for the reply, but allowNullBody is not under user control as >> it is set in AggregationStrategyBeanInfo(99) when calling: >> Expression newBody = ExpressionBuilder.mandatoryBodyExpression(newType); >> because mandatoryBodyExpression() just calls >> mandatoryBodyExpression(type, false) where the second param is >> nullBodyAllowed. >> I don't see any attribute to control >> AggregationStrategyBeanInfo.createMethodInfo()'s behavior at that >> point, so either default should not ask for mandatory body, or it >> should be configurable somehow. >> >> On Fri, May 23, 2014 at 12:39 PM, Claus Ibsen wrote: >>> You need to turn on allowNullBody or something like that >>> >>> >>> On Fri, May 23, 2014 at 11:33 AM, Radu Badita wrote: >>>> Hi all, >>>> I'm fairly new Camel user, but I'm pretty sure this is an issue: >>>> I'm using a POJO Aggregator to aggregate the response from an Enrich >>>> EAI. The strategy method has two parameters, one for the 'oldExchange' >>>> message body and the other for the 'newExchange' message body; in my >>>> case a Map and an Object respectively. >>>> The problem is that when the response is null, before my aggregation >>>> strategy method is invoked, message body has to be obtained from the >>>> 'newExchange' which is not null, but the in-message body is. The >>>> object is extracted with "mandatoryBodyExpression" which throws >>>> exception: >>>> "InvalidPayloadException: No body available of type: java.lang.Object >>>> on: Message: [Body is null]." >>>> Is there a reason to require mandatory body in response? In this case >>>> I guess null responses cannot be handled, so probably it shouldn't. >>>> Regards, >>>> Radu B >>> >>> >>> >>> -- >>> Claus Ibsen >>> ----------------- >>> Red Hat, Inc. >>> Email: cibsen@redhat.com >>> Twitter: davsclaus >>> Blog: http://davsclaus.com >>> Author of Camel in Action: http://www.manning.com/ibsen >>> hawtio: http://hawt.io/ >>> fabric8: http://fabric8.io/ > > > > -- > Claus Ibsen > ----------------- > Red Hat, Inc. > Email: cibsen@redhat.com > Twitter: davsclaus > Blog: http://davsclaus.com > Author of Camel in Action: http://www.manning.com/ibsen > hawtio: http://hawt.io/ > fabric8: http://fabric8.io/