|
RSS Feed - WebSphere MQ Support
|
RSS Feed - Message Broker Support
|
 |
|
XA issues |
« View previous topic :: View next topic » |
Author |
Message
|
IntegratorWMB |
Posted: Fri Jan 09, 2009 8:31 am Post subject: XA issues |
|
|
Apprentice
Joined: 06 Dec 2007 Posts: 27
|
Note: I apologize reposting from jms forum. I think this forum might be a better forum to answer.
****************
Hi,
We have our own Enterprise app framework and it has a Transaction service which acts a wrapper for all transaction client request to JOTM transaction manager. most of our transaction falls in to one of these catagories:
a) xa start - db[1] update ....db[n] update - xa end
b) xa start - db[1] update - MQ send - db[2] update -xa end
The above scenarios working fine.
Now we are seeing issue with the following scenario
a) xa start - db[1] update - MQserver1 Q1 snd - MQserver1 Q2 snd - db[2] update - xa end
After MQserver1 Q1 snd the system seems to hang. Debugging shows the code hangs when we try to enlist the MQ server Q2 XA Resource with the Transaction manager (JOTM). Is this because both the queues are on the same physical MQ Server..
When I remove the enlist part for MQ Server Q2 ...the code fails trying to send the message with SYNCPOINT_NOT_AVAILABLE for Q2., when I ran the test for only one queue as part of XA, it works for both the queues. Here is the sample test code :
----
Jotm jotm = new Jotm(true, false);
TransactionManager tm = jotm.getTransactionManager();
XAResource mqXAResource1;
XAResource mqXAResource2;
Get the connection factory ....
XAConnection connection1 = connectionFactory.createXAConnection();
XASession session1 = connection1.createXASession();
mqXAResource1 = session1.getXAResource();
XAConnection connection2 = connectionFactory.createXAConnection();
XASession session2 = connection2.createXASession();
mqXAResource2 = session2.getXAResource();
connection1.start();
connection2.start();
MessageProducer producer1 = session1.getSession().createProducer(sndDest1);
MessageProducer producer2 = session2.getSession().createProducer(sndDest2);
tm.begin();
tm.getTransaction().enlistResource(mqXAResource1);
// Note: If the following line is uncommented code hangs here
tm.getTransaction().enlistResource(mqXAResource2);
producer1.send(session.createTextMessage("MESSAGE1"));
//If enlisting code above was commented the following line
// throws Completion Code 2, Reason 2072 error
producer2.send(session.createTextMessage("MESSAGE2"));
tm.getTransaction().delistResource(mqXAResource1, XAResource.TMSUCCESS);
tm.getTransaction().delistResource(mqXAResource2, XAResource.TMSUCCESS);
tm.commit();
// .... stop..close() for producers, sessions & connection done here
Any pointers appreciated.
Thanks. |
|
Back to top |
|
 |
fjb_saper |
Posted: Sat Jan 10, 2009 3:35 am Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
Why are you creating 2 qmgrs / qcfs and 2 different sessions?
Use the MQ network to move the message to Q2 on Qmgr2 and post that message to Qmgr1 in the same session.
If your connection to the qmgr is a "bindings" connection (and it would have to be to be XA without the transactional client) then remember that MQ will only tolerate one qcf being used at at time in bindings mode in the JVM!
So unless both qcfs are connecting in client mode and you have the transactional client you will not be able to achieve what you are trying to do the way you designed it (MQ bridge)...
Enjoy  _________________ MQ & Broker admin |
|
Back to top |
|
 |
IntegratorWMB |
Posted: Sun Jan 11, 2009 7:12 pm Post subject: |
|
|
Apprentice
Joined: 06 Dec 2007 Posts: 27
|
Why are you creating 2 qmgrs / qcfs and 2 different sessions?
>>>No. There is only one queue manager. The queue connection factory is binded to LDAP server and I get the object reference using JNDI lookup. The same connection factory is used to create two XA connection.
If your connection to the qmgr is a "bindings"
>>> MQ is running in a remote server and the client code using mqetclient (externded transaction client) for connecting to the server.
Thanks. |
|
Back to top |
|
 |
fjb_saper |
Posted: Sun Jan 11, 2009 8:06 pm Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
How about enlisting the resource right after the session creation and before starting the connection?
How about delisting the resource only after the tm.commit() call?
Enjoy  _________________ MQ & Broker admin |
|
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
|
|
|
|