|
RSS Feed - WebSphere MQ Support
|
RSS Feed - Message Broker Support
|
 |
|
Messages being commited without commit |
« View previous topic :: View next topic » |
Author |
Message
|
edmondh |
Posted: Fri Feb 17, 2006 7:02 am Post subject: Messages being commited without commit |
|
|
Novice
Joined: 17 Feb 2006 Posts: 14 Location: London
|
Hi there
I am sending several message to message queue with max message depth of 3.
When I send >3 message exception occurs, in my exception handling
I call
queue.close()
qMgr.diconnect
However, message remain on Queue. I find this strange.... as I have set SYNC_POINT
does to MQQUeneManager leave messages on Queue on disconnect() if explicit backout() call isn't made.... this is what I am experiencing but cannot find explicit documentation....
Conside this code
MQQueueManager qMgr = null;
try{
qMgr = new MQQueueManager(mgrName);
MQQueue queue = qMgr.accessQueue(targetQueueName, MQC.MQOO_OUTPUT, null, null, null);
MQMessage outMessage = new MQMessage();
outMessage.clearMessage(); outMessage.correlationId = MQC.MQCI_NONE;
outMessage.messageId = MQC.MQMI_NONE;
outMessage.format = MQC.MQFMT_STRING;
outMessage.writeString("THis is MQSTR message");
MQPutMessageOptions mOptions = new MQPutMessageOptions();
mOptions.options = MQC.MQPMO_SYNCPOINT; //send message to queue
queue.put(outMessage,mOptions);
queue.put(outMessage,mOptions);
queue.put(outMessage,mOptions);
queue.put(outMessage,mOptions);
queue.put(outMessage,mOptions);
queue.close();
qMgr.commit();
}catch (MQException e) {
//qMgr.backout();
e.printStackTrace();
throw e;
}finally{
qMgr.disconnect();
}
If backout reamin commneted out Message reamain on Queue, but I would have expected not to be on Queue as SYN_POINT is set _________________ Thank you for your time
Ed |
|
Back to top |
|
 |
wschutz |
Posted: Fri Feb 17, 2006 7:08 am Post subject: |
|
|
 Jedi Knight
Joined: 02 Jun 2005 Posts: 3316 Location: IBM (retired)
|
There is an implicit COMMIT done on MQDISC, it is behaving as expected. _________________ -wayne |
|
Back to top |
|
 |
jefflowrey |
Posted: Fri Feb 17, 2006 7:10 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
So if you also comment out qMgr.disconnect, then you will see the behavior you expect to see.
But then your MQ admin might start complaining that you are leaving connections open when you shoulnd't be.
So make sure you commit or backout explicitly in all cases, and disconnect in all cases. _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
wschutz |
Posted: Fri Feb 17, 2006 7:16 am Post subject: |
|
|
 Jedi Knight
Joined: 02 Jun 2005 Posts: 3316 Location: IBM (retired)
|
Quote: |
So if you also comment out qMgr.disconnect, then you will see the behavior you expect to see.
|
but be aware that some execution environments will issue an implicit "MQDISC" for you if the program terminates normally (with an implicit MQCMIT)... so to expand on Jeff's suggestion, your program should always end like this:
Code: |
COMMIT
CLOSE all queues
DISCONNECT from MQ
|
_________________ -wayne |
|
Back to top |
|
 |
edmondh |
Posted: Fri Feb 17, 2006 7:23 am Post subject: |
|
|
Novice
Joined: 17 Feb 2006 Posts: 14 Location: London
|
"There is an implicit COMMIT done on MQDISC, it is behaving as expected."
This is exactly what I wanted to heat, what is MQDISC?Is there a quick answer? _________________ Thank you for your time
Ed |
|
Back to top |
|
 |
wschutz |
Posted: Fri Feb 17, 2006 7:26 am Post subject: |
|
|
 Jedi Knight
Joined: 02 Jun 2005 Posts: 3316 Location: IBM (retired)
|
MQDISC==qmgr.disconnect(); _________________ -wayne |
|
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
|
|
|
|