0
votes

What's the différence between forceCompletionOnStop and completeAllOnStop ? it is possible or recommanded to use both togheter ?

From the documentation:

forceCompletionOnStop Indicates to complete all current aggregated exchanges when the context is stopped

completeAllOnStop Indicates to wait to complete all current and partial (pending) aggregated exchanges when the context is stopped. This also means that we will wait for all pending exchanges which are stored in the aggregation repository to complete so the repository is empty before we can stop. You may want to enable this when using the memory based aggregation repository that is memory based only, and do not store data on disk. When this option is enabled, then the aggregator is waiting to complete all those exchanges before its stopped, when stopping CamelContext or the route using it.

Its little confusing for me it seems to be the same

1

1 Answers

1
votes

completeAllOnStop is a "normal" completion criteria. The Camel aggregator implements the ShutdownAware interface and the completeAllOnStop criteria indicates to the Camel context that the aggregator needs some extra time before shutdown to complete its aggregations.

forceCompletionOnStop on the other hand tries to complete all aggregations during the shutdown process (prepareShutdown).

So to me they seem very similar too, both are trying to complete all aggregations before shutdown of the Camel context. I would recommend to use completeAllOnStop because this seems to be the more proactive way. See also the Camel Docs for more info about the shutdown strategy.

I don't know if you get a "double check" if you configure them both :-)

Be aware that even forceCompletionOnStop is skipped if the shutdown is a forced shutdown! In this case Camel tries to shutdown as fast as possible. As far as I know Camel does a forced shutdown when the normal shutdown is not successful within a timeout.