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 Index » Multiphase Commit » MQ5.3, .NET API, COM+ distributed transaction enlisting

Post new topic  Reply to topic
 MQ5.3, .NET API, COM+ distributed transaction enlisting « View previous topic :: View next topic » 
Author Message
TimothyV
PostPosted: Mon Dec 17, 2007 5:35 am    Post subject: MQ5.3, .NET API, COM+ distributed transaction enlisting Reply with quote

Novice

Joined: 17 Dec 2007
Posts: 17

Hi,

I'm having the following problem. It's quite the same as this one:

http://www.mqseries.net/phpBB2/viewtopic.php?t=17763&highlight=mq+dtc

i'm running on Win2000. I have the server installed on my machine (Websphere MQ 5.3)

I have a client applcation in .NET. There i open a transactionscope, in this transaction scope i exeucte some database stuff, on different servers, and at last i want to put a msg on a queue. This last action is developed in a service component (com+) local on my machine. (I have been following the guidance in the "WebSphere MQ Solutions in a Microsoft .NET Environment" red book. In particular the "Automatic transactions using .NET declarative transaction management" on page 297. )

Now what i see is following, before i make the call to the serviced component i already have a distributed com+ transaction due to the different db actions on different servers. When i make the call to the serviced component (com+), i see the logic that has to put the message on the queue adds another com+ transaction, instead of inlisting in the one i already have.

Can someone help me on this one please?
Back to top
View user's profile Send private message
jefflowrey
PostPosted: Mon Dec 17, 2007 6:18 am    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

You can't do two phase commit with a client connection, unless you're using the Extended transactional client.

And I'm not sure if the Extended Transactional Client works in this case, either (with MSDTC).
_________________
I am *not* the model of the modern major general.
Back to top
View user's profile Send private message
TimothyV
PostPosted: Mon Dec 17, 2007 6:20 am    Post subject: Reply with quote

Novice

Joined: 17 Dec 2007
Posts: 17

hi,

first off all thx for the response.

I read about making the connection via mqm.dll. This way the i would establisch something that's called a 'server' connection.

System.Collections.Hashtable properties = new System.Collections.Hashtable();
properties.Add(MQC.TRANSPORT_PROPERTY, MQC.TRANSPORT_MQSERIES_BINDINGS);

MQQueueManager _mqQmgr = _mqQmgr = new MQQueueManager("qm_amqtsivt", properties);
Back to top
View user's profile Send private message
TimothyV
PostPosted: Mon Dec 17, 2007 6:33 am    Post subject: Reply with quote

Novice

Joined: 17 Dec 2007
Posts: 17

Mabye i have to add some more information:

this is my code:

Code:
[Transaction(TransactionOption.Required)]
    public class CUSTOM_MQ : ServicedComponent
    {

        public CUSTOM_MQ()
        {
           
        }

        [AutoComplete]
        public void Put()
        {

            MQMessage mqMsg = null;
            MQQueue mqQueue = null;

            try
            {
                MQPutMessageOptions opt = new MQPutMessageOptions();
                opt.Options |= IBM.WMQ.MQC.MQPMO_SYNCPOINT;

                System.Collections.Hashtable properties = new System.Collections.Hashtable();
                properties.Add(MQC.TRANSPORT_PROPERTY, MQC.TRANSPORT_MQSERIES_BINDINGS);

                MQQueueManager _mqQmgr = _mqQmgr = new MQQueueManager("qm_amqtsivt", properties);

                mqQueue = _mqQmgr.AccessQueue("TestQueueTimothy", MQC.MQOO_INPUT_AS_Q_DEF | MQC.MQOO_OUTPUT);
                mqMsg = new MQMessage();
                mqMsg.Format = IBM.WMQ.MQC.MQFMT_STRING;
                mqMsg.WriteString(DateTime.Now.ToString("HH:mm:ss"));
                mqQueue.Put(mqMsg, opt);

                mqQueue.Close();
            }
            finally
            {
                if (mqQueue != null && mqQueue.IsOpen)
                    mqQueue.Close();
            }


         
             
          //  throw new Exception("test");

        }
 
    }


So what i see is, that the code is actually working with a new com+ transaction that is started at the moment i connect to the queue manager.


So when i uncomment the "throw new exception" at the end, everything is rolled back for this transaction, and when i comment out the "throw new exception" the message is put on the queue. So everything works fine with the new transaction.

The problem is, that is starts a NEW transaction, and does not enlist in the already existing transaction.
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Mon Dec 17, 2007 1:41 pm    Post subject: Reply with quote

Grand High Poobah

Joined: 18 Nov 2003
Posts: 20696
Location: LI,NY

moved to Multiphase Commit forum
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
jefflowrey
PostPosted: Mon Dec 17, 2007 2:32 pm    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

So, a two-phase commit is when you have two resources in one transaction.

Like a DB and the Qmgr.

Which you can't do with a plain MQ client connection. As you have shown yourself.

You can, as you have shown yourself, that you can create a transaction against MQ, and a separate transaction against a DB. And you can commit and rollback those transactions separately.

Just not in one transaction.
_________________
I am *not* the model of the modern major general.
Back to top
View user's profile Send private message
TimothyV
PostPosted: Mon Dec 17, 2007 10:37 pm    Post subject: Reply with quote

Novice

Joined: 17 Dec 2007
Posts: 17

Ok, that makes things clear

And how can i make this work? This should be possible right?

Now when i read this thread: http://www.mqseries.net/phpBB2/viewtopic.php?t=17763&highlight=mq+dtc , he seems to get it working...
Back to top
View user's profile Send private message
Vitor
PostPosted: Tue Dec 18, 2007 1:43 am    Post subject: Reply with quote

Grand High Poobah

Joined: 11 Nov 2005
Posts: 26093
Location: Texas, USA

TimothyV wrote:
And how can i make this work? This should be possible right?


2-phase commit is only possible client side using the ETC, not the standard client. It's supported server side, and I've commented on that in the other thread.
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » Multiphase Commit » MQ5.3, .NET API, COM+ distributed transaction enlisting
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.