I have a requirement to read messages from database and send it to JMS queue. Since I may have millions of messages per minute, I have to read the data in a multi threaded clustered environment.
I was thinking that I will read chunks of data in one thread, say 1000 records per thread and then send that data to JMS queue. The issue I have here is that how do I ensure that other threads don't read the data that is already read by another thread. I would have synchronized my method that reads data if it was a not a clustered app.
Another thought that I have now is to use select for update in Oracle so that other threads wait when they try to access the data from the table but that will make other threads wait most of the time.
Please suggest what should I do to achieve this.
Any suggestion is higly appreciated.