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 » IBM MQ API Support » Messages being commited without commit

Post new topic  Reply to topic
 Messages being commited without commit « View previous topic :: View next topic » 
Author Message
edmondh
PostPosted: Fri Feb 17, 2006 7:02 am    Post subject: Messages being commited without commit Reply with quote

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
View user's profile Send private message
wschutz
PostPosted: Fri Feb 17, 2006 7:08 am    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail AIM Address
jefflowrey
PostPosted: Fri Feb 17, 2006 7:10 am    Post subject: Reply with quote

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
View user's profile Send private message
wschutz
PostPosted: Fri Feb 17, 2006 7:16 am    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail AIM Address
edmondh
PostPosted: Fri Feb 17, 2006 7:23 am    Post subject: Reply with quote

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
View user's profile Send private message
wschutz
PostPosted: Fri Feb 17, 2006 7:26 am    Post subject: Reply with quote

Jedi Knight

Joined: 02 Jun 2005
Posts: 3316
Location: IBM (retired)

MQDISC==qmgr.disconnect();
_________________
-wayne
Back to top
View user's profile Send private message Send e-mail AIM Address
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » IBM MQ API Support » Messages being commited without commit
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.