|
RSS Feed - WebSphere MQ Support
|
RSS Feed - Message Broker Support
|
 |
|
question on working with MQ TRASACTION SCOPE and .net |
« View previous topic :: View next topic » |
Author |
Message
|
sharonv |
Posted: Sun Nov 19, 2017 1:29 am Post subject: question on working with MQ TRASACTION SCOPE and .net |
|
|
Apprentice
Joined: 03 Feb 2011 Posts: 27
|
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:
Code: |
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?
This is important, because in our application, each access queue is done from a different sequential transaction scope, and at the end of the day the connection to the manager is closed.
We need to know how to correctly open the mqManager connection to ensure it will participate in later transaction scopes. |
|
Back to top |
|
 |
|
|
 |
|
Page 1 of 1 |
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|
|
|