Reputation: 1
I am working with MQClient 7.5.0.5, with MQ API for .net application.
If I open an MQManager connection using WMQ.MQQueueManager not in a transaction scope, The connection will not participate in any transaction I open later on. However, if the connect is done within a transaction scope, the connection will participate in any other transaction scopes later (unrelated to the first transaction scope the connection was opened in). to explain further:
I have a DoWork method:
void DoWork(MQManager mqManager)
{
//Write to DB
......
queue = mqManager.AccessQueue(queueName, MQOO_OUTPUT)
MQPutMessageOptions op = new MQPutMessageOptions();
op.options = MQPMO_SYNCPOINT;
queue.Put(msg, options);
queue.Close();
}
When the code is like this, the connection does not participate in transaction:
mqManager = new MQManager("MgName","ChName","Srv(port)");
using(scope = new transaction scope)
{
DoWork(mqManager)
scope.complete();
}
mqManager.dossconnect();
When the code is like this, the connection participate in both transactions:
MQManager mqManager = null;
using(scope1 = new transaction scope)
{
mqManager = new MQManager("MgName","ChName","Srv(port)");
scope.complete()
}
using(scope = new transaction scope)
{
DoWork(mqManager);
scope.complete();
}
mqManager.dossconnect();
Why is that? I cannot find documentation on this subject. All I found was IBM documentation claiming that : "A connection might participate in several transactions, but only one transaction is active at any point of time." But nothing about when or how to open the connection. I would expect it to be like a DB connection, which participated only in the transaction scope it is opened in, but here the MQmanager connection participates in any transaction, only if it was opened within a transaction scope to begin with....
Can anyone explain this to me?
Upvotes: 0
Views: 184
Reputation: 1316
There were couple of APAR's in this area.APAR IT16143 introduced changes in the MQ.NET XA Samples that were shipped with MQ.And the other APAR is IT16606. As per the XA specification, a connection can participate only in one active transaction at a given time. The error MQRC_GLOBAL_UOW_CONFLICT is reported if a previous transaction for a connection is still active when the connection is used inside another unit of work. In order to prevent this error, the application should be designed in a way that 2 transactional unit does not share the same connection handle simultaneously.Following link talks more about transactions. https://www.ibm.com/support/knowledgecenter/en/SSFKSJ_7.5.0/com.ibm.mq.dev.doc/q029290_.htm
Upvotes: 1