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 » How to know the current debth of the receiving queue

Post new topic  Reply to topic
 How to know the current debth of the receiving queue « View previous topic :: View next topic » 
Author Message
arisco97
PostPosted: Fri Jun 25, 2004 1:33 pm    Post subject: How to know the current debth of the receiving queue Reply with quote

Newbie

Joined: 17 Sep 2002
Posts: 1

Hi,

Am not conversant much with JMS, but my team is using JMS. Is there a way in Java to inquire the current debth (i.e. actual number of messages waiting in the queue to be retrieved).

We need this for a re-active measure to manage incoming traffic and be able to send a message back to various senders to hold off sending more messages until we can get them off the queue.

Thanks
Back to top
View user's profile Send private message Yahoo Messenger MSN Messenger
bower5932
PostPosted: Sat Jun 26, 2004 1:29 am    Post subject: Reply with quote

Jedi Knight

Joined: 27 Aug 2001
Posts: 3023
Location: Dallas, TX, USA

You can't get the current depth with JMS. If you to use the base MQ classes to have this ability.
Back to top
View user's profile Send private message Send e-mail Visit poster's website AIM Address Yahoo Messenger
fjb_saper
PostPosted: Sat Jun 26, 2004 5:31 am    Post subject: Reply with quote

Grand High Poobah

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

As always there are two sides to the story.

Yes there is no way to directly get the QDepth in JMS.

There is however a workaround. It is slow and resource intensive but it will get the job done.

Create a QueueBrowser, retrieve the enumeration and count (call method getnextElement() ) until the method hasmoreElements returns false.

Usually nobody uses this in JMS because this method is too resource intensive and too costly....

Now you could write a wrap around for JMS but that will involve going back to MQ java and to do that you will need to cast your QueueConnectionFactory back to an MQQueueConnectionFactory, extract the properties, cast the JMS Queue to a JMS MQQueue extract the properties and then program the call in MQ java....

Too much work....

The option I would go for is to add the admin package to your program, create a pcf message requesting the currentQDepth and put it on the command server's input queue with a reply to jms destination. You will have to decode the response message...

If on os390 just use a plain text message runmqsc style to the input queue and specify the reply to queue.


F.J.
Back to top
View user's profile Send private message Send e-mail
bower5932
PostPosted: Sat Jun 26, 2004 8:51 am    Post subject: Reply with quote

Jedi Knight

Joined: 27 Aug 2001
Posts: 3023
Location: Dallas, TX, USA

I'd avoid the QueueBrowser and enumerate method. If your queue had a large number of messages, you'd basically be getting them simply to thrown them away so that you could get the count. There is no telling what kind of performance problems you'd end up with.
Back to top
View user's profile Send private message Send e-mail Visit poster's website AIM Address Yahoo Messenger
vennela
PostPosted: Sat Jun 26, 2004 3:38 pm    Post subject: Reply with quote

Jedi Knight

Joined: 11 Aug 2002
Posts: 4055
Location: Hyderabad, India

Quote:
We need this for a re-active measure to manage incoming traffic and be able to send a message back to various senders to hold off sending more messages until we can get them off the queue.

This has other solutions rather than using curdepth.
Can't we use performance events to get the job done?
Back to top
View user's profile Send private message Send e-mail Visit poster's website
jefflowrey
PostPosted: Sat Jun 26, 2004 3:57 pm    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

vennela wrote:
This has other solutions rather than using curdepth.
Can't we use performance events to get the job done?


Yes, I'm sure this can be done.

In addition, I don't personally think it is a good idea (for a few reasons) to include this kind of monitoring in a business application. Self-monitoring is only as good as the app itself...

It's much better for the architecture, reliability, and maintenance of an application to keep it tightly focused on only those things it's supposed to be doing.
_________________
I am *not* the model of the modern major general.
Back to top
View user's profile Send private message
balaji sr
PostPosted: Mon Jun 28, 2004 3:38 am    Post subject: Reply with quote

Apprentice

Joined: 07 Jan 2003
Posts: 28

I am not sure how to implement this in JMS. But this can be done in Java - MQSeries using MQInquiry
If you are interested in this apporach, you can get the sample code from
http://java.ittoolbox.com/code/d.asp?i=8&a=c and look for mqInquiry java sample code......
Back to top
View user's profile Send private message Yahoo Messenger MSN Messenger
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » IBM MQ Java / JMS » How to know the current debth of the receiving 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.