L.S.,
The onCompletion() will get triggered for every single message, but you could add an aggregator in there (e.g. using a time-out as the one you're using in your main route) to figure out when all messages have been consumed and then do the cleanup work once the aggregator has completed. Regards, Gert Vanthienen On Wed, Nov 6, 2013 at 7:39 PM, jay <[email protected]> wrote: > Hi guys, > I have a requirement to call some bean/pojo or processor to clean some stuff > once all the messages are processed from the queue (_from). > > But my on completion is getting invoked for every single message. Could > someone let me know your views on what is wrong i am doing here. > > below is my code : > onCompletion().beanRef("MyBean", "xyzMethod"); > from(_from).routeId("myRouteID") > .process(new MyProcessor()) > .choice() > .when(header("VALID_MSG").isEqualTo("false" )) > .log(" Error") > .otherwise() > .aggregate( header("ID"), new > MyAggregator()).completionTimeout(getAggregationTimeout()) > .process(processor); > > > > -- > View this message in context: > http://servicemix.396122.n5.nabble.com/OnCompletion-issue-in-Fuse-SMX-tp5718319.html > Sent from the ServiceMix - User mailing list archive at Nabble.com.
