On Mon, Oct 29, 2012 at 1:23 PM, ladoe00 <lado...@yahoo.com> wrote: > Hi, > > my application is running inside OSGi and I am using an > AggregationStrategy that will write data to a file. While this file is > being "aggregated", it's location is in a temp directory and when the > aggregation times out or completes, we move the file to the application's > output directory. My AggregationStrategy implements > CompletionAwareAggregationStrategy and TimeoutAwareAggregationStrategy and > the onCompletion(), timeout() callbacks are implemented. All of this work > until I want to shutdown my OSGi container. I have set the > forceCompletionOnStop() flag on the AggregationProcessor, but the > onCompletion() callback is not called when there is no pending exchange. In > other words, if I shutdown my system while it is idle (i.e. nothing to > aggregate) and before the aggregation timeout, my onCompletion() callback is > not called. > > How can I nicely notify my AggregationStrategy when the application is > shutting down? >
So you want the AggregationStrategy to have the callback invoked, regardless if there is no pending exchanges being aggregated? We could consider allowing the AggregationStrategy to be a Service which has start() and stop() callbacks. Then Camel can invoke these accordingly. Then you can do house-keeping logic there as well. > Thanks! > > > > -- > View this message in context: > http://camel.465427.n5.nabble.com/How-to-shutdown-AggregationStrategy-when-there-is-no-InFlight-exchange-tp5721729.html > Sent from the Camel - Users mailing list archive at Nabble.com. -- Claus Ibsen ----------------- Red Hat, Inc. FuseSource is now part of Red Hat Email: cib...@redhat.com Web: http://fusesource.com Twitter: davsclaus Blog: http://davsclaus.com Author of Camel in Action: http://www.manning.com/ibsen