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 8160910F38 for ; Thu, 29 May 2014 13:26:55 +0000 (UTC) Received: (qmail 76307 invoked by uid 500); 29 May 2014 13:26:55 -0000 Delivered-To: apmail-camel-users-archive@camel.apache.org Received: (qmail 76257 invoked by uid 500); 29 May 2014 13:26:55 -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 76249 invoked by uid 99); 29 May 2014 13:26:55 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 29 May 2014 13:26:55 +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 (athena.apache.org: domain of claus.ibsen@gmail.com designates 209.85.223.180 as permitted sender) Received: from [209.85.223.180] (HELO mail-ie0-f180.google.com) (209.85.223.180) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 29 May 2014 13:26:51 +0000 Received: by mail-ie0-f180.google.com with SMTP id tp5so265422ieb.39 for ; Thu, 29 May 2014 06:26:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type; bh=OxZBqi5QWvEACJM/MxxGmXOnqvGvawIKFZRiW1CsdIo=; b=If4AW4xzGnFwZQ7K6xNFNPi+vtj/DZmzuJF6LrObS+MOTFA3eFy1pNTUy6JByEfCgw GCswsgwTgAVZeLwpKZ6ThLn7t86xcph/jlMR9oeu1S22C/je34CRIFJxn1FF0On4dN5B K/yB1hR8lLy2bDM+rvsP/GR+2A9oW/actV+54PIV4u/Mp5PP/kzdOhq65rnpkvyCeck7 YMidkCYDhS4+Nvub+QbV95D1nBQgcIT2K8F7cdnwt8/M1x9VeAE/y3qBHCjB4WbDFCQu bEB1lHbrBiwNo+wWq6+cxVSnzAnobfiN8UN2LKXot+0awixy85TMagyvlDqHZoFMIYJZ IeEA== X-Received: by 10.50.79.161 with SMTP id k1mr10447495igx.31.1401369990779; Thu, 29 May 2014 06:26:30 -0700 (PDT) MIME-Version: 1.0 Received: by 10.64.6.97 with HTTP; Thu, 29 May 2014 06:26:10 -0700 (PDT) In-Reply-To: References: From: Claus Ibsen Date: Thu, 29 May 2014 15:26:10 +0200 Message-ID: Subject: Re: AggregationStrategyBeanAdapter potential issue when using POJO aggregator and receiving null response To: "users@camel.apache.org" Content-Type: text/plain; charset=UTF-8 X-Virus-Checked: Checked by ClamAV on apache.org On Fri, May 23, 2014 at 3:32 PM, Radu Badita wrote: > 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). > Hi Did your enrich hit a timeout, or is the null body indeed a response from the enrich endpoint you used? We could look into adding an option to allow null body as a valid response. > 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/ -- 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/