camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From srinidandi <>
Subject Re: Synchronization in camel route
Date Wed, 05 May 2010 11:18:15 GMT


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?

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


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
> <> 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:
>> Sent from the Camel - Users mailing list archive at
> -- 
> Claus Ibsen
> Apache Camel Committer
> Author of Camel in Action:
> Open Source Integration:
> Blog:
> Twitter:

View this message in context:
Sent from the Camel - Users mailing list archive at

View raw message