I have been hunting and hunting for a way/solution for this but basically my route is below. The idea is I get the start time as soon as I receive a message, I get the stop time as soon as the route is complete and on complete only, lastly I record the difference and some other metadata in a database. When using a single route consumer (NOT asyncConsumers or asyncConsumers = 1) this works great. As soon as I turn on concurrent consumers and up the async consumer count the took property is the same for all of the consumers even when the math is wrong. It's as if the took property is being held on to by the first loop through the route. I've tried using properties and not headers. I've tried including it as part of the route and not using the onCompletion clause. I've tried other things that is beyond count. All to no avail. Could anyone help or tell me how I can get an accurate throughput into a database table with multiple concurrent consumers? Requiring the record of each throughput of the route in a database and having multiple concurrent consumers are a must. The route and a table example are below. The concurrentConsumers are set to true and asyncConsumers count is set to 3. I can copy some configs if necessary.
Psuedo route: from jms:some.queue setProperty start = System.currentTimeInMillis to bean:doWork setProperty stop = System.currentTimeInMillis setProperty took = stop - start onCompletion setBody exchange.getProperties to sql: insert in myTable(routeId, completed_at, took) <camel:route id="getattributesImgRepos" errorHandlerRef="defaultErrorHandler"> <camel:from uri="jms:queue:imagingcontinuum.repo.getattributes" /> <camel:setProperty propertyName="start"> <camel:simple>${bean:java.lang.System?method=currentTimeMillis}</camel:simple> </camel:setProperty> <camel:to uri="bean:cmServices?method=getAttributes" /> <camel:setProperty propertyName="stop"> <camel:simple>${bean:java.lang.System?method=currentTimeMillis}</camel:simple> </camel:setProperty> <camel:setProperty propertyName="took"> <camel:javaScript>exchange.getProperty('stop') - exchange.getProperty('start')</camel:javaScript> </camel:setProperty> <camel:onCompletion onCompleteOnly="true"></camel:onCompletion> <camel:setHeader headerName="completed_at"><camel:simple>${property.stop}</camel:simple></camel:setHeader> <camel:setHeader headerName="took_ms"><camel:simple>${property.took}</camel:simple></camel:setHeader> <camel:setHeader headerName="stat_nm"><camel:constant>retrieve</camel:constant></camel:setHeader> <camel:to uri="sql:insert into statistic (statistic_name, completed_at, took_ms) values (:#stat_nm, :#completed_at, :#took_ms);?dataSource=aDataSource" /> </camel:route> Database results: statistic_id statistic_name completed_at took_ms 2186525 retrieve 1387238491594 6312 2186526 retrieve 1387238492472 6312 2186527 retrieve 1387238495947 6312 Any help and recommendation would be grealy appreciated. -- View this message in context: http://camel.465427.n5.nabble.com/Camel-JMS-asyncConsumers-and-onCompletion-tp5744902.html Sent from the Camel Development mailing list archive at Nabble.com.