You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Tim Pierce <ti...@gmail.com> on 2013/03/08 20:18:38 UTC

Issue: Aggregator2 : BatchCompletion disturbed by other completions and fails to happen (when it probably should)

There is a bug - at least I assume it not desired functionality where if
you have more than one completion of which .completionFromBatchConsumer()
is one of them

if Exchange property CamelBatchSize is 2505 and .completionSize( ) is 1000

you would like batches of

1000 - compeltionSize
1000 - completionSize
505 - batchCompletion

but actually this will never happen, this is because the batch-counter
AtomicInteger does not get updated if a different completion occurs, so in
the above example
the counter will finish at 2503 and never reach 2505, because each time the
completionSize occured the method quit

it could be easily remedied by moving the onCompletionBatch section of the
method

AggregateProcessor: isCompleted(String key, Exchange exchange)

to the top of the method instead of the bottom.

batchConsumerCounter is the thing that doesnt get updated if another
compeltion occurs

I'd be happy to code this and submit it, but not sure if that sioluition
fits with your existing ideas about the module. It looks fairly obvivously
like a bug to me... if you guys are happy with that.
sorry not written a test-case

Re: Issue: Aggregator2 : BatchCompletion disturbed by other completions and fails to happen (when it probably should)

Posted by Claus Ibsen <cl...@gmail.com>.
Hi

I have logged a ticket and have a fix in the works
https://issues.apache.org/jira/browse/CAMEL-6172

On Sat, Mar 9, 2013 at 9:13 AM, Claus Ibsen <cl...@gmail.com> wrote:
> On Fri, Mar 8, 2013 at 8:18 PM, Tim Pierce <ti...@gmail.com> wrote:
>> There is a bug - at least I assume it not desired functionality where if
>> you have more than one completion of which .completionFromBatchConsumer()
>> is one of them
>>
>> if Exchange property CamelBatchSize is 2505 and .completionSize( ) is 1000
>>
>> you would like batches of
>>
>> 1000 - compeltionSize
>> 1000 - completionSize
>> 505 - batchCompletion
>>
>> but actually this will never happen, this is because the batch-counter
>> AtomicInteger does not get updated if a different completion occurs, so in
>> the above example
>> the counter will finish at 2503 and never reach 2505, because each time the
>> completionSize occured the method quit
>>
>> it could be easily remedied by moving the onCompletionBatch section of the
>> method
>>
>> AggregateProcessor: isCompleted(String key, Exchange exchange)
>>
>> to the top of the method instead of the bottom.
>>
>> batchConsumerCounter is the thing that doesnt get updated if another
>> compeltion occurs
>>
>> I'd be happy to code this and submit it, but not sure if that sioluition
>> fits with your existing ideas about the module. It looks fairly obvivously
>> like a bug to me... if you guys are happy with that.
>> sorry not written a test-case
>
> Hi
>
> The completionFromBatchConsumer option is intended to be used as the
> only completion if we route from a batch consumer, and want to
> aggregate and complete that batch. Combining that completion with the
> other completions was not intended originally.
>
> But I can see your use-case.
>
> And if we can support that as well, then that would be fine.
>
> Fell free to log a JIRA and work on a patch. And adding an unit test
> to cover this use-case would be great.
> http://camel.apache.org/contributing.html
>
> --
> Claus Ibsen
> -----------------
> Red Hat, Inc.
> FuseSource is now part of Red Hat
> Email: cibsen@redhat.com
> Web: http://fusesource.com
> Twitter: davsclaus
> Blog: http://davsclaus.com
> Author of Camel in Action: http://www.manning.com/ibsen



-- 
Claus Ibsen
-----------------
Red Hat, Inc.
FuseSource is now part of Red Hat
Email: cibsen@redhat.com
Web: http://fusesource.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen

Re: Issue: Aggregator2 : BatchCompletion disturbed by other completions and fails to happen (when it probably should)

Posted by Claus Ibsen <cl...@gmail.com>.
On Fri, Mar 8, 2013 at 8:18 PM, Tim Pierce <ti...@gmail.com> wrote:
> There is a bug - at least I assume it not desired functionality where if
> you have more than one completion of which .completionFromBatchConsumer()
> is one of them
>
> if Exchange property CamelBatchSize is 2505 and .completionSize( ) is 1000
>
> you would like batches of
>
> 1000 - compeltionSize
> 1000 - completionSize
> 505 - batchCompletion
>
> but actually this will never happen, this is because the batch-counter
> AtomicInteger does not get updated if a different completion occurs, so in
> the above example
> the counter will finish at 2503 and never reach 2505, because each time the
> completionSize occured the method quit
>
> it could be easily remedied by moving the onCompletionBatch section of the
> method
>
> AggregateProcessor: isCompleted(String key, Exchange exchange)
>
> to the top of the method instead of the bottom.
>
> batchConsumerCounter is the thing that doesnt get updated if another
> compeltion occurs
>
> I'd be happy to code this and submit it, but not sure if that sioluition
> fits with your existing ideas about the module. It looks fairly obvivously
> like a bug to me... if you guys are happy with that.
> sorry not written a test-case

Hi

The completionFromBatchConsumer option is intended to be used as the
only completion if we route from a batch consumer, and want to
aggregate and complete that batch. Combining that completion with the
other completions was not intended originally.

But I can see your use-case.

And if we can support that as well, then that would be fine.

Fell free to log a JIRA and work on a patch. And adding an unit test
to cover this use-case would be great.
http://camel.apache.org/contributing.html

-- 
Claus Ibsen
-----------------
Red Hat, Inc.
FuseSource is now part of Red Hat
Email: cibsen@redhat.com
Web: http://fusesource.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen