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 » General IBM MQ Support » put between XAResource start and end not part of XA transctn

Post new topic  Reply to topic
 put between XAResource start and end not part of XA transctn « View previous topic :: View next topic » 
Author Message
richardellery
PostPosted: Mon Apr 16, 2007 10:58 am    Post subject: put between XAResource start and end not part of XA transctn Reply with quote

Newbie

Joined: 16 Apr 2007
Posts: 7

Hello,

I am trying to create a scenario using MQ 5.3 FP 12 for Windows.

The code below creates an XAResoure and QueueManger from an MQXAQueueManager. The problem is that the put to MyQueue commits immediately, despite the fact it is between the start() and end() methods. When prepare() is called, XA_RDONLY is returned, indicating that there is no MQ series work to commit. The message is already on the queue.

I'd be grateful if someone could tell me what I am doing wrong. The put needs to be prepared and committed at the end of the code sample. Thanks very much, in advance.

java.util.Properties properties = new Properties();
properties.put(MQC.TRANSPORT_PROPERTY, MQC.TRANSPORT_MQSERIES_BINDINGS);
properties.put(MQC.THREAD_AFFINITY, new Boolean(true));

MQXAQueueManager xaQMrg = new MQXAQueueManager("", properties);

MQXAResource xaRes = xaQMrg.getXAResource();

Xid xid = new MyXid(123456, "1234".getBytes(), "56787".getBytes());

qMgr = xaQMrg.getQueueManager();

xaRes.start(xid, XAResource.TMNOFLAGS);


MQMessage hello_world = new MQMessage();
hello_world.writeUTF("Hello World!");

int openOptions = MQC.MQOO_OUTPUT ;

MQQueue myQueue = qMgr.accessQueue("qlTestIn", openOptions,
null, null, null);

myQueue.put(hello_world);

xaRes.end(xid, XAResource.TMSUCCESS);
int prepareRc = xaRes.prepare(xid);
System.out.println ("Prepare returned " + prepareRc);


xaRes.rollback(xid);
qMgr.close();
_________________
Richard Ellery
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Mon Apr 16, 2007 1:40 pm    Post subject: Reply with quote

Grand High Poobah

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

Did you set syncpoint on the open queue options/ put message options??
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
jefflowrey
PostPosted: Mon Apr 16, 2007 1:57 pm    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

Did you properly configure the qmgr to be the transaction manager, or otherwise register it as a resource manager with your transaction manager?

The same with the database you're trying to involve in the same transaction?
_________________
I am *not* the model of the modern major general.
Back to top
View user's profile Send private message
richardellery
PostPosted: Mon Apr 16, 2007 2:37 pm    Post subject: Reply with quote

Newbie

Joined: 16 Apr 2007
Posts: 7

Thanks very much - I had not set the SYNCPOINT (I had tried setting it, but passed the flag into the accessQueue method). Passing it directly as an option to the put is clearly what was needed. Thanks again!
_________________
Richard Ellery
Back to top
View user's profile Send private message
BenR
PostPosted: Mon Apr 16, 2007 10:47 pm    Post subject: Reply with quote

Acolyte

Joined: 31 Jan 2006
Posts: 60
Location: Hursley, UK

I'm pretty sure that this

Quote:

MQXAQueueManager xaQMrg = new MQXAQueueManager("", properties);


is not a published API, so you should not be calling it from an application. It might happen to work (or, at least, appear to) but if it's not published you're unlikely to get help if something goes wrong.
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » General IBM MQ Support » put between XAResource start and end not part of XA transctn
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.