You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@camel.apache.org by Stephan Burkard <sb...@gmail.com> on 2014/02/03 16:52:58 UTC

Aggregator completionSize = 1

Hi

Motivated by Claus' nice words :-) and to take a whiff of the Camel code, I
analyzed my own Jira issue CAMEL-7146.

In the method "doAggregation" the aggregator evaluates if the aggregation
is complete. With completionSize = 1 this is the case on every Exchange.
Therefore the aggregator does not persist the Exchanges:

=> complete = "size", therefore every exchange goes in else-case
...
if (complete == null) {
    doAggregationRepositoryAdd(newExchange.getContext(), key,
originalExchange, answer);
...
} else {
...

On the other hand does the method "onCompletion" no such evaluation and
tries to delete the Exchange in the Repository. Therefore the NPE.

So, completionSize = 1 is a special case since it basically says "do not
aggregate". This raises the question if Camel should throw an Exception on
context startup

Re: Aggregator completionSize = 1

Posted by Stephan Burkard <sb...@gmail.com>.
Sorry, the message was sent too early...

The question to the Camel gurus is: what is more preferable:

1) On completionSize = 1 Camel throws an exception on context startup since
this is treated as "invalid configuration"

2) The aggregator should just check for the very special case of
completionSize = 1 and skip the removal in the repository if this is true

Thanks
Stephan




On Mon, Feb 3, 2014 at 4:52 PM, Stephan Burkard <sb...@gmail.com> wrote:

> Hi
>
> Motivated by Claus' nice words :-) and to take a whiff of the Camel code,
> I analyzed my own Jira issue CAMEL-7146.
>
> In the method "doAggregation" the aggregator evaluates if the aggregation
> is complete. With completionSize = 1 this is the case on every Exchange.
> Therefore the aggregator does not persist the Exchanges:
>
> => complete = "size", therefore every exchange goes in else-case
> ...
> if (complete == null) {
>     doAggregationRepositoryAdd(newExchange.getContext(), key,
> originalExchange, answer);
> ...
> } else {
> ...
>
> On the other hand does the method "onCompletion" no such evaluation and
> tries to delete the Exchange in the Repository. Therefore the NPE.
>
> So, completionSize = 1 is a special case since it basically says "do not
> aggregate". This raises the question if Camel should throw an Exception on
> context startup
>