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 » General Discussion » How to get the number of messages in a Queue?

Post new topic  Reply to topic
 How to get the number of messages in a Queue? « View previous topic :: View next topic » 
Author Message
sas_kannan
PostPosted: Wed Sep 14, 2005 1:13 am    Post subject: How to get the number of messages in a Queue? Reply with quote

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
View user's profile Send private message Visit poster's website Yahoo Messenger MSN Messenger
wschutz
PostPosted: Wed Sep 14, 2005 1:38 am    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail AIM Address
wschutz
PostPosted: Wed Sep 14, 2005 1:40 am    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail AIM Address
dgolding
PostPosted: Wed Sep 14, 2005 2:57 am    Post subject: 2033 Reply with quote

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
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » General Discussion » How to get the number of messages in a Queue?
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.