ASG
IBM
Zystems
Cressida
Icon
Netflexity
 
  MQSeries.net
Search  Search       Tech Exchange      Education      Certifications      Library      Info Center      SupportPacs      LinkedIn  Search  Search                                                                   FAQ  FAQ   Usergroups  Usergroups
 
Register  ::  Log in Log in to check your private messages
 
RSS Feed - WebSphere MQ Support RSS Feed - Message Broker Support

MQSeries.net Forum IndexIBM MQ API Supportquestion on working with MQ TRASACTION SCOPE and .net

Post new topicReply to topic
question on working with MQ TRASACTION SCOPE and .net View previous topic :: View next topic
Author Message
sharonv
PostPosted: Sun Nov 19, 2017 1:29 am Post subject: question on working with MQ TRASACTION SCOPE and .net Reply with quote

Novice

Joined: 03 Feb 2011
Posts: 24

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
View user's profile Send private message
Display posts from previous:
Post new topicReply to topic Page 1 of 1

MQSeries.net Forum IndexIBM MQ API Supportquestion on working with MQ TRASACTION SCOPE and .net
Jump to:



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
Protected by Anti-Spam ACP


Theme by Dustin Baccetti
Powered by phpBB 2001, 2002 phpBB Group

Copyright MQSeries.net. All rights reserved.