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 Java / JMS » getCurrentDepth returns zero after put()

Post new topic  Reply to topic
 getCurrentDepth returns zero after put() « View previous topic :: View next topic » 
Author Message
alfia_786
PostPosted: Tue Nov 13, 2007 3:07 pm    Post subject: getCurrentDepth returns zero after put() Reply with quote

Novice

Joined: 13 Nov 2007
Posts: 12

I am a newbie in Websphere mq series,trying to learn this IBM stuff..
i am writing a very simple code to send the message to the queue but after calling put() when I try to print the current depth of the send queue its always zero,does that mean the messages are not sent,i tried getting the messages but that didnt work either,is there a way to find out if the messages are sent to the queue successfully

here is the code:

qMgr = new MQQueueManager(qManager);
int openOptions = MQC.MQOO_INPUT_AS_Q_DEF | MQC.MQOO_OUTPUT
| MQC.MQOO_INQUIRE ;
MQQueue q =qMgr.accessQueue("ERT003_APPL_SEND_QUEUE", openOptions, null, null, null);
MQMessage mBuf = new MQMessage();
MQPutMessageOptions pmo = new MQPutMessageOptions();
pmo.options = MQC.MQPMO_NONE; // use defaults
mBuf.clearMessage();
mBuf.correlationId = MQC.MQCI_NONE; // set correlationId
mBuf.messageId = MQC.MQMI_NONE; // set messageId
mBuf.writeString("testing123"); // set actual message
out.println("--> writing message to queue");
q.put(mBuf, pmo);
out.println("Send queue depth:" + q.getCurrentDepth());
q.close();
qMgr.disconnect();
Back to top
View user's profile Send private message
jefflowrey
PostPosted: Tue Nov 13, 2007 3:37 pm    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

It's yet another illustration of why business applications should never rely on queue depth to make decisions.

If you don't get an MQRC >0 and MQCC>0, then your PUT succeeded.
_________________
I am *not* the model of the modern major general.
Back to top
View user's profile Send private message
Vitor
PostPosted: Wed Nov 14, 2007 1:32 am    Post subject: Reply with quote

Grand High Poobah

Joined: 11 Nov 2005
Posts: 26093
Location: Texas, USA

Reinforcing the comments of my illustrious associate, you'll find the principle illustrated in the sample code available. It's well worth a look to get you started.
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Wed Nov 14, 2007 2:06 am    Post subject: Reply with quote

Grand High Poobah

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

Looks suspiciously like a QueueRemote. A QR has no depth as the message gets either rerouted or hits the xmitq and probably is already through the channel by the time you try to check the qdepth...
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
Vitor
PostPosted: Wed Nov 14, 2007 2:14 am    Post subject: Reply with quote

Grand High Poobah

Joined: 11 Nov 2005
Posts: 26093
Location: Texas, USA

fjb_saper wrote:
Looks suspiciously like a QueueRemote. A QR has no depth as the message gets either rerouted or hits the xmitq and probably is already through the channel by the time you try to check the qdepth...


It's a possibility it's it? Though I can't say I've ever actually asked a QR what it's depth was. It's a tribute to IBM software if it returns a sensible answer to such an odd question....
_________________
Honesty is the best policy.
Insanity is the best defence.


Last edited by Vitor on Wed Nov 14, 2007 2:33 am; edited 1 time in total
Back to top
View user's profile Send private message
zpat
PostPosted: Wed Nov 14, 2007 2:29 am    Post subject: Reply with quote

Jedi Council

Joined: 19 May 2001
Posts: 5866
Location: UK

Did the PUT succeed? Did any of the MQI calls succeed? There does not seem to be any MQRC checking.
Back to top
View user's profile Send private message
Vitor
PostPosted: Wed Nov 14, 2007 2:34 am    Post subject: Reply with quote

Grand High Poobah

Joined: 11 Nov 2005
Posts: 26093
Location: Texas, USA

zpat wrote:
Did the PUT succeed? Did any of the MQI calls succeed?


And there's the other possibility!
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
jefflowrey
PostPosted: Wed Nov 14, 2007 2:58 am    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

zpat wrote:
There does not seem to be any MQRC checking.


To be fair, this seems to be .NET and the object-oriented interface.... so one wouldn't check the Return Code or Completion Code of the calls... merely catch any exceptions that were thrown, and then report the Return Code or Completion Code from that.
_________________
I am *not* the model of the modern major general.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » IBM MQ Java / JMS » getCurrentDepth returns zero after put()
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.