|
RSS Feed - WebSphere MQ Support
|
RSS Feed - Message Broker Support
|
 |
|
How to get the number of messages in a Queue? |
« View previous topic :: View next topic » |
Author |
Message
|
sas_kannan |
Posted: Wed Sep 14, 2005 1:13 am Post subject: How to get the number of messages in a Queue? |
|
|
Newbie
Joined: 27 Aug 2005 Posts: 8 Location: Tirunelveli
|
Hi,
I am using MQ Series 5.3.
I contact a Local Queue from a java application, I am able to put and get messages into it. The problem is when there is no messages in the queue it throws the exception following
com.ibm.mq.MQException: MQJE001: Completion Code 2, Reason 2033
at com.ibm.mq.MQQueue.get(MQQueue.java:913)
at MQDemo.getMessage(MQDemo.java:63)
at MQImplementation$4.mouseClicked (MQImplementation.java:527) .........
Is it possible to get the number of messages in a Queue from Java?
Is it possible to keep track of the read messages?
Any help is appreciated...
Thanks in Advance,
With Regards,
S.A. Senthil Kannan |
|
Back to top |
|
 |
wschutz |
Posted: Wed Sep 14, 2005 1:38 am Post subject: |
|
|
 Jedi Knight
Joined: 02 Jun 2005 Posts: 3316 Location: IBM (retired)
|
Have you seen this in the MQ java manual?
Quote: |
getCurrentDepth
public int getCurrentDepth() throws MQException;
Gets the number of messages currently on the queue. This value is incremented during a put call and during backout of a get call. It is decremented during a non-browse get and during backout of a put call.
|
_________________ -wayne |
|
Back to top |
|
 |
wschutz |
Posted: Wed Sep 14, 2005 1:40 am Post subject: |
|
|
 Jedi Knight
Joined: 02 Jun 2005 Posts: 3316 Location: IBM (retired)
|
By the way, why don't you just code your java program to handle the 2033 condition? It simply means there are no messages leff and the normal programming model is to get messages until a 2033 is returned. _________________ -wayne |
|
Back to top |
|
 |
dgolding |
Posted: Wed Sep 14, 2005 2:57 am Post subject: 2033 |
|
|
 Yatiri
Joined: 16 May 2001 Posts: 668 Location: Switzerland
|
Besides GetCurrentDepth isn't guaranteed to be the number of GETtable messages, because it contains a count of messages that have been PUT'd but not committed.
An example of this is, we have some Java code that does a loop with the counter set to the value returned by GetCurrentDepth. Every so often it the GET fails with a 2033 - which it interprets as an error condition and dies.
This code is provided by an external supplier and despite pleading to rewrite this crap code, it's still in use.... |
|
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
|
|
|
|