Closed karelg closed 6 years ago
Rebus.SqlServer 5.0.0-b9 uses the READCOMMITTEDLOCK
lock hint, which (at least on my machine) seems to work properly, also when running the database with snapshot isolation enabled.
Thanks for reporting this issue 👍
We are currently using Rebus with Rebus.SqlServer transport on a database where _READ_COMMITTEDSNAPSHOT option is set to ON. Everything works fine so long we are using only single process for consuming events, but things will broke as soon as we try to add additional processes. We think the problem is related to ROWLOCK and READPAST hints, that Rebus.SqlServer relies on dequeuing messages, but unfortunately are not working correctly with SNAPSHOT isolation level, that is used now instead of Rebus.SqlServer's default READ COMMITED isolation level (cause of _READ_COMMITTEDSNAPSHOT ON database option). One possible solution to this problem might be to add an additional table hint READCOMMITTEDLOCK to the Rebus.SqlServer dequeue SQL command. You can read more about READCOMMITTEDLOCK table hint at Microsofts own documentation: