Topic
  • 1 reply
  • Latest Post - ‏2016-12-12T14:42:26Z by fjb_saper
dpatek
dpatek
1 Post

Pinned topic .NET. Reusing a MQQueueManger in Distributed Transaction

‏2016-11-15T21:30:17Z | .net transaction

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.

Thank you!

 

 

Updated on 2016-11-15T22:37:12Z at 2016-11-15T22:37:12Z by dpatek
  • fjb_saper
    fjb_saper
    240 Posts

    Re: .NET. Reusing a MQQueueManger in Distributed Transaction

    ‏2016-12-12T14:42:26Z  

    Did you try specifying a "require new transaction" for each message?  Do not try and enroll multiple loop instances into the same transaction object if they are not part of the same transaction.