Author |
Message
|
doug |
Posted: Mon Aug 09, 2004 6:34 am Post subject: MQSeries.NET and Transaction rollback |
|
|
Novice
Joined: 27 May 2003 Posts: 11
|
I'm having some problems getting messages received under syncpoint to rollback. I'm sure I'm doing something dumb, but it eludes me at the moment.
Scenario is 5.3 client on WinXP, queue manager on 5.1 server in Win2K. Code snippet as follows:-
Code: |
using IBM.WMQ;
MQQueueManager m_oMQMgr = null;
MQQueue m_oMQ = null;
MQEnvironment.Channel = "CHANNEL1";
MQEnvironment.Port = 1414;
MQEnvironment.Hostname = "MYHOST";
m_oMQMgr = new MQQueueManager();
m_oMQMgr.Connect();
MQMessage mqMsg=new MQMessage();
MQGetMessageOptions mqGMO = new MQGetMessageOptions();
mqGMO.Options = MQC.MQGMO_NO_WAIT +
MQC.MQGMO_CURRENT_VERSION +
MQC.MQGMO_SYNCPOINT;
m_oMQ.Get( mqMsg, mqGMO );
...
m_oMQMgr.Backout();
|
The message disappears from the queue after the Get and does not get put back on the queue after the Backout. I've tried with persistent and non-persistent messages and the result is the same.
Any clues?
Thanks,
Doug |
|
Back to top |
|
 |
JasonE |
Posted: Wed Aug 25, 2004 4:19 am Post subject: |
|
|
Grand Master
Joined: 03 Nov 2003 Posts: 1220 Location: Hursley
|
Are you still having the problem (I was away when this was posted)? |
|
Back to top |
|
 |
doug |
Posted: Wed Aug 25, 2004 5:10 am Post subject: MQSeries.NET and Transaction rollback |
|
|
Novice
Joined: 27 May 2003 Posts: 11
|
I'm still having the problem. In addition to the mentioned configuration, I've also tried on a 5.3 server connecting to the 5.1 queue manager and also connecting to a local queue manager on the 5.3 server. I can't get messages to rollback in any configuration.
Either the syncpoint option is being ignored for some reason on the Get, or an implicit Commit is happening (I'd be suprised if it was the latter)
Any pointers would be gratefully received |
|
Back to top |
|
 |
JasonE |
Posted: Wed Aug 25, 2004 5:43 am Post subject: |
|
|
Grand Master
Joined: 03 Nov 2003 Posts: 1220 Location: Hursley
|
Have you got a small testcase I could try here? Alternatively you could email me a client side trace if you dont mind getting it - Just let me know where to download it from, or PM me and I'll let you know my email addr |
|
Back to top |
|
 |
bower5932 |
Posted: Wed Aug 25, 2004 6:21 am Post subject: |
|
|
 Jedi Knight
Joined: 27 Aug 2001 Posts: 3023 Location: Dallas, TX, USA
|
I just gave this a try using WMQ 5.3 CSD7. I tried it both in bindings mode and in client mode and both of them either rolled back or committed successfully when asked to. |
|
Back to top |
|
 |
fjb_saper |
Posted: Wed Aug 25, 2004 12:34 pm Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
looking at your code snippet I could not find where you defined the queue.
I just can't believe that you would be able to do a get on a null object:
Quote: |
MQQueue m_oMQ = null;
MQEnvironment.Channel = "CHANNEL1";
MQEnvironment.Port = 1414;
MQEnvironment.Hostname = "MYHOST";
m_oMQMgr = new MQQueueManager();
m_oMQMgr.Connect();
MQMessage mqMsg=new MQMessage();
MQGetMessageOptions mqGMO = new MQGetMessageOptions();
mqGMO.Options = MQC.MQGMO_NO_WAIT +
MQC.MQGMO_CURRENT_VERSION +
MQC.MQGMO_SYNCPOINT;
m_oMQ.Get( mqMsg, mqGMO ); |
Are you trapping any of the errors ?
Do you perform a rollback if an error occurs or just exiting the app. ?
Hope it helps some. |
|
Back to top |
|
 |
doug |
Posted: Thu Aug 26, 2004 12:47 am Post subject: |
|
|
Novice
Joined: 27 May 2003 Posts: 11
|
In my enthusiasm to cut down the code snippet to a readable level, I missed out the crucial:-
Code: |
m_oMQ = m_oMQMgr.AccessQueue(txtQueue.Text ,
MQC.MQOO_FAIL_IF_QUIESCING + MQC.MQOO_OUTPUT + MQC.MQOO_INPUT_AS_Q_DEF);
|
after the connect.
Gets do work, they just don't rollback. All errors are trapped and I don't see anything reported (unless I do a MQQueueManager.Begin....but then it says it isn't supported for local transactions)[/code] |
|
Back to top |
|
 |
JasonE |
Posted: Thu Aug 26, 2004 2:29 am Post subject: |
|
|
Grand Master
Joined: 03 Nov 2003 Posts: 1220 Location: Hursley
|
For reference, the problem (I was emailing Doug) was the following:
Quote: |
The trace shows you arent using syncpoint and hence the MQGET is committed immediately!
Code: |
| GMO Options {+008} | 00000005
| | 00000001 MQGMO_WAIT (Wait)
| | 00000004 MQGMO_NO_SYNCPOINT (No syncpoint) |
Your code however is different!
MQMessage mqMsg=new MQMessage();
MQGetMessageOptions mqGMO = new MQGetMessageOptions();
mqGMO.Options = MQC.MQGMO_NO_WAIT + MQC.MQGMO_CURRENT_VERSION + MQC.MQGMO_SYNCPOINT;
m_oMQ.Get( mqMsg, mqGMO );
However...
MQC.MQGMO_CURRENT_VERSION isnt a valid MQGMO Option field! (It goes in the Version field)
This results in
MQC.MQGMO_NO_WAIT + MQC.MQGMO_CURRENT_VERSION + MQC.MQGMO_SYNCPOINT ==
0 + 3 + 2 == 5
5 == MQGMO_WAIT | MQGMO_NO_SYNCPOINT
|
|
|
Back to top |
|
 |
doug |
Posted: Thu Aug 26, 2004 2:56 am Post subject: |
|
|
Novice
Joined: 27 May 2003 Posts: 11
|
Doh! I gracefully accept the Wally of the week award.
Thanks Jason |
|
Back to top |
|
 |
|