camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Claus Ibsen <>
Subject Re: Synchronization in camel route
Date Tue, 04 May 2010 15:19:02 GMT

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:

View raw message