I'm writing a .NET application using TransactionScope [.Net transactions]. The code is a simple loop using the same MQQueueManager instance:
- receive from a Topic subscription
- save to MSSQL db
- send translated message to another Topic
- commit transaction
When I get to the top to get the new message, I get a MQRC_GLOBAL_UOW_CONFLICT exception.
I understand that transaction commit is asynchronous and the queue manager might not be ready yet to participate in a new transaction. How do I determine that it is ready? I subscribed to the TransactionCompleted event on Transaction.Current and waited for that to fire before re-entering the loop. Same exception. I was able to avoid the exception by sleeping for 10 milliseconds, but I don't want to put hard timeouts on this. There must be a 'proper' way to know.