Author |
Message
|
alfia_786 |
Posted: Tue Nov 13, 2007 3:07 pm Post subject: getCurrentDepth returns zero after put() |
|
|
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 |
|
 |
jefflowrey |
Posted: Tue Nov 13, 2007 3:37 pm Post subject: |
|
|
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 |
|
 |
Vitor |
Posted: Wed Nov 14, 2007 1:32 am Post subject: |
|
|
 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 |
|
 |
fjb_saper |
Posted: Wed Nov 14, 2007 2:06 am Post subject: |
|
|
 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 |
|
 |
Vitor |
Posted: Wed Nov 14, 2007 2:14 am Post subject: |
|
|
 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 |
|
 |
zpat |
Posted: Wed Nov 14, 2007 2:29 am Post subject: |
|
|
 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 |
|
 |
Vitor |
Posted: Wed Nov 14, 2007 2:34 am Post subject: |
|
|
 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 |
|
 |
jefflowrey |
Posted: Wed Nov 14, 2007 2:58 am Post subject: |
|
|
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 |
|
 |
|