camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Claus Ibsen <claus.ib...@gmail.com>
Subject Re: AggregationStrategyBeanAdapter potential issue when using POJO aggregator and receiving null response
Date Thu, 29 May 2014 13:26:10 GMT
On Fri, May 23, 2014 at 3:32 PM, Radu Badita <radu.badita@gmail.com> 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 <claus.ibsen@gmail.com> 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 <radu.badita@gmail.com> 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 <claus.ibsen@gmail.com> wrote:
>>>> You need to turn on allowNullBody or something like that
>>>>
>>>>
>>>> On Fri, May 23, 2014 at 11:33 AM, Radu Badita <radu.badita@gmail.com>
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/

Mime
View raw message