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

Claus Ibsen commented on CAMEL-4097:
------------------------------------

forceCompletionOfAllGroups only flushes the partial aggregated exchanges, so 
they get submitted to the thread pool. See the onCompletion and 
onSubmitCompletion methods.

Then the logic in doStop will continue and stop recoverService, timeoutMap and 
the other pieces.
So you would in theory have to adjust this logic so eg processor, 
deadLetterProcessor, recoverService is not stopped.
So the internal stuff is still running to allow the flushed exchanges to be 
processed without problems.
And then after the exchanges has been completed, then those should be stopped. 
And in top of this you have a timeout to ensure that stopping the aggregator do 
not block forever for some odd reason.

So it becomes a bit harder to handle.

Instead we may want to allow Processor's in the route to prepare for 
shutdown/stop. A bit like the ShutdownAware. 
So we have some sort of pre event that signals about to stop, and allow any 
ShutdownAware processor to prepare for this. Then the logic is separated, in 
that preparation logic we can also allow the processors to return a 
pendingExchangesSize so it can tell how many exchanges it have buffered. See 
the DefaultShutdownStrategy how we do this currently for consumers.

So what we should do is probably extend this so ShutdownStrategy does the 
ShutdownAware for all the Processor's in the route as well (after the 
consumers).  

For example the resequencer EIP pattern is also stateful and could have a 
similar option, to flush on stopping.


> Add option on aggregation to flush on shutdown
> ----------------------------------------------
>
>                 Key: CAMEL-4097
>                 URL: https://issues.apache.org/jira/browse/CAMEL-4097
>             Project: Camel
>          Issue Type: New Feature
>          Components: camel-core
>            Reporter: Claus Ibsen
>            Assignee: Ben O'Day
>            Priority: Minor
>             Fix For: 2.9.0
>
>         Attachments: CAMEL-4097.patch
>
>
> We may want to add options to stateful EIPs such as aggregator/resequencer 
> that they should flush on shutdown. People who dont use a persistent store 
> would loose the in-memory partly aggregated exchanges.
> See nabble
> http://camel.465427.n5.nabble.com/Aggregator-completeOnShutdown-tp4423774p4423774.html

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to