[ 
https://issues.apache.org/jira/browse/CAMEL-3535?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12981597#action_12981597
 ] 

Brian Feaver commented on CAMEL-3535:
-------------------------------------

Looking through it a bit more, I believe the problem is related to the Pipeline 
that is created when there is a bean before the aggregation. Without the 
Pipeline, each exchange's unit of work is done after each iteration of the 
aggregation. When there is a pipeline, the pipeline is creating the next 
exchange as a copy of the first exchange and the unit of work for the copy is 
what is done instead of the original exchange. But the exchange that is stored 
within the aggregation repository is the original exchange, still with a unit 
of work defined (it hasn't been done, and therefore hasn't been set to null). 
When the aggregation completes, the UnitOfWorkProcessor finds the unit of work 
in the original exchange and doesn't complete that unit of work (process() 
method in UnitOfWorkProcessor).

{code}
// There was an existing UoW, so we should just pass through..
// so that the guy the initiated the UoW can terminate it.
return processor.process(exchange, callback);
{code}

Since the unit of work never gets done, it never calls the 
AggregateOnCompletion.onComplete() method. In a debugger, I ended up nulling 
out the UnitOfWork on the exchange before it finished the aggregation and it 
worked as expected.

> Aggregation fails to call onComplete for exchanges if the aggregation is 
> after a bean or process.
> -------------------------------------------------------------------------------------------------
>
>                 Key: CAMEL-3535
>                 URL: https://issues.apache.org/jira/browse/CAMEL-3535
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-core
>    Affects Versions: 2.5.0
>            Reporter: Brian Feaver
>            Assignee: Claus Ibsen
>             Fix For: 2.6.0
>
>         Attachments: AggregationTest.java
>
>
> When creating a route that contains an aggregation, if that aggregation is 
> preceded by a bean or process, it will fail to call 
> AggregateOnCompletion.onComplete(). I've attached a unit test that can show 
> you the behavior. Trace level loggging will need to be enabled to see the 
> difference. With the call to the bean, it won't show the following log entry:
> {noformat}TRACE org.apache.camel.processor.aggregate.AggregateProcessor - 
> Aggregated exchange onComplete: Exchange[Message: ab]{noformat}
> If you remove the bean call, it'll start calling onComplete() again.
> What I've noticed is that if this call is not made, it ends up in a memory 
> leak since the inProgressCompleteExchanges HashSet in AggregateProcessor 
> never has any exchange ID's removed.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to