On Wed, May 5, 2010 at 1:18 PM, srinidandi <shrinivas.dandibho...@corpus.com> wrote: > > Hi, > > Thanks for the reply. > > The route uses threads() or asynchronous processing feature so that multiple > asynchronous threads get spawned to process a multitude of csv files that > get put in a specifc folder on the server. This could be the potential > reason for concurrent inserts/updates to happen? >
Well you could use threads(1) to only have one consumer which works on the DB part. But I would start out single threaded and then only if its too slow look into concurrency. > Also not really sure if the use of threads() in the above case really > increases the performance or a single threaded route will provide adequate > performace. > Well you can ask the computer about the performance :) > Thanks > > > > Claus Ibsen-2 wrote: >> >> Hi >> >> Why do you have concurrent updates? You can use 1 consumer and thus >> only have one thread working with your database? >> >> You may also want to use SELECT FOR UPDATE in the SQL if you want to >> "lock" it as you want to do an update afterwards. >> There are tons of stuff you can do with SQL to lock tables and whatnot. >> >> >> On Mon, May 3, 2010 at 11:53 AM, srinidandi >> <shrinivas.dandibho...@corpus.com> wrote: >>> >>> Hi, >>> >>> Does Camel provide any synchronization feature in a route? I have a >>> simple >>> route defined inside a router class where I read a input csv file, >>> process >>> it and store/insert the information if the mandatory field does not exist >>> in >>> the database while do an update if the mandatory field exists in the >>> database. >>> >>> The problem is sometimes there are more than one inserts when the >>> mandatory >>> field is not present in the database obviously since there might be more >>> than one thread thats doing a select of the mandatory field in db, not >>> finding it and so doing an insert. What is missing is synchronization of >>> a >>> part of the route where the select and insert/update are happening. >>> >>> The problem might get solved by using threads(1) inside the route; but I >>> was >>> wondering if there is some sort of synchronize() method that I can call >>> inside the route? If there is one any, can you please give an example? >>> >>> Thanks >>> >>> >>> >>> >>> >>> -- >>> View this message in context: >>> http://old.nabble.com/Synchronization-in-camel-route-tp28433290p28433290.html >>> Sent from the Camel - Users mailing list archive at Nabble.com. >>> >>> >> >> >> >> -- >> Claus Ibsen >> Apache Camel Committer >> >> Author of Camel in Action: http://www.manning.com/ibsen/ >> Open Source Integration: http://fusesource.com >> Blog: http://davsclaus.blogspot.com/ >> Twitter: http://twitter.com/davsclaus >> >> > > -- > View this message in context: > http://old.nabble.com/Synchronization-in-camel-route-tp28433290p28459538.html > Sent from the Camel - Users mailing list archive at Nabble.com. > > -- Claus Ibsen Apache Camel Committer Author of Camel in Action: http://www.manning.com/ibsen/ Open Source Integration: http://fusesource.com Blog: http://davsclaus.blogspot.com/ Twitter: http://twitter.com/davsclaus