Sunday, May 1, 2011

SQL Server and message queues

I'm trying to build a reliable message service, or at least that's how I would describe it.

Here's my problem: I have a table, I insert data into this table, I have at least two applications which select data from this table. However, I need a reliable way for the two different applications to never select the same rows at any given time.

How would I go about writing a transaction or select statement that is guaranteed to not select the same rows that other applications have recently selected.

I'm not an SQL Server expert, but I would expect something similar to this.

Select work from table, this will give the application exclusive access to some rows. The application would then process those rows. Some rows get deleted, some rows are returned to the database.

My main concern is that if the application fails to complete it's processing, SQL Server would eventually time out and return the checked out data to the application data pool.

From stackoverflow

0 comments:

Post a Comment