Author |
Message
|
phanideepm |
Posted: Mon Nov 05, 2007 10:43 pm Post subject: Not able to backout messages when not committing |
|
|
Newbie
Joined: 05 Nov 2007 Posts: 4
|
Hi all, my requirement is to backout the msg in to queue during application abnormal termination or when commit call is not made. i am using mq java api where i am setting MQC.MQGMO_SYNCPOINT option on MQGetMessageOptions obj and issuing get call on mqqueue obj . please let me know if any thing else is need to set when process happens in local unit of work. please help me... |
|
Back to top |
|
 |
Nigelg |
Posted: Mon Nov 05, 2007 11:22 pm Post subject: |
|
|
Grand Master
Joined: 02 Aug 2004 Posts: 1046
|
Check the usage notes in the APR, MQDISC, for whayt happens when an app ends, normally or abnormally, without calling MQCMIT or MQBACK. _________________ MQSeries.net helps those who help themselves.. |
|
Back to top |
|
 |
phanideepm |
Posted: Mon Nov 05, 2007 11:27 pm Post subject: |
|
|
Newbie
Joined: 05 Nov 2007 Posts: 4
|
according usage notes msg ill be backedout incase of abnormal termination but that is not happening. my doubt is whether i need to set any thing else apart from syncpoint option on get msg options..
thanks for the reply |
|
Back to top |
|
 |
Vitor |
Posted: Tue Nov 06, 2007 1:03 am Post subject: |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
Are you saying that the message remains consumed or that it's not on the backout queue specified for the queue it was read from?
If the latter, then remember that the queue manager doesn't honour this setting, only records it. Some app servers (I notice you're using Java) do honour it as part of the JMS service. If you are in such a configuration, check the backout settings on the original queue.
If the former, make sure the message really is under a syncpoint. _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
phanideepm |
Posted: Tue Nov 06, 2007 1:29 am Post subject: |
|
|
Newbie
Joined: 05 Nov 2007 Posts: 4
|
Yes, the message remains consumed. Did the following to check if the queue manager is under sync point -
System.out.println("resQueueManager.getSyncpointAvailability() : " + resQueueManager.getSyncpointAvailability());
The result is 1 (MQC.MQSP_AVAILABLE). Anything else needs to be checked ?
Pls find the code below to read the message with sync point option set
MQMessage msg = new MQMessage();
MQGetMessageOptions gmo = new MQGetMessageOptions();
gmo.waitInterval = TIMEOUT;
gmo.options = MQC.MQGMO_SYNCPOINT + MQC.MQGMO_WAIT + MQC.MQGMO_VERSION_2;
resQueue.get(msg, gmo);
byte[] readArr = new byte[msg.getDataLength()];
msg.readFully(readArr);
textMsg = new String(readArr); |
|
Back to top |
|
 |
jefflowrey |
Posted: Tue Nov 06, 2007 3:13 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
There are different behaviors in different languages for default behavior of rollback/commit during abnormal termination. You may, for example, need to explicitly issue a rollback(). _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
phanideepm |
Posted: Wed Nov 07, 2007 2:06 am Post subject: |
|
|
Newbie
Joined: 05 Nov 2007 Posts: 4
|
i am issuing rollback in the shutdown hook but i didnt get positive results |
|
Back to top |
|
 |
bower5932 |
Posted: Wed Nov 07, 2007 5:20 am Post subject: |
|
|
 Jedi Knight
Joined: 27 Aug 2001 Posts: 3023 Location: Dallas, TX, USA
|
|
Back to top |
|
 |
|