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 » Newbie: get a count of number of messages in a que

Post new topic  Reply to topic
 Newbie: get a count of number of messages in a que « View previous topic :: View next topic » 
Author Message
rmalghan
PostPosted: Wed Apr 08, 2009 10:12 am    Post subject: Newbie: get a count of number of messages in a que Reply with quote

Newbie

Joined: 09 May 2008
Posts: 8

Hi: I have installed the MQ JAVA API client on a server and have been able to run the sample code (MQSample) to connect to MQ server. This sample script just puts a message in the que and fetches it back. I am trying to build a script that checks the number of messages in a que. I am very new to MQ and this integration. Can someone provide me pointers or sample scripts which might do this?

TIA
Ravi
Back to top
View user's profile Send private message
mqjeff
PostPosted: Wed Apr 08, 2009 10:13 am    Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

Why do you need to know how many messages are on the queue?

Here's a big hint - you almost certainly don't.
Back to top
View user's profile Send private message
rmalghan
PostPosted: Wed Apr 08, 2009 10:21 am    Post subject: Reply with quote

Newbie

Joined: 09 May 2008
Posts: 8

I have a commercial application which sometimes hangs and stops pulling messages from the que. The que starts filling up if I donot restart the client application. I have been unable to figure out what causes the issue in the application (could be application or network or the MQ server). I want to write a small script which will count the messages in the ques so I can get notified when the number of messages exceed a threshold number.
mqjeff wrote:
Why do you need to know how many messages are on the queue?

Here's a big hint - you almost certainly don't.
Back to top
View user's profile Send private message
Vitor
PostPosted: Wed Apr 08, 2009 11:14 am    Post subject: Reply with quote

Grand High Poobah

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

rmalghan wrote:
I can get notified when the number of messages exceed a threshold number.


Use a DEPTH trigger.
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
mqjeff
PostPosted: Wed Apr 08, 2009 11:15 am    Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

Vitor wrote:
rmalghan wrote:
I can get notified when the number of messages exceed a threshold number.


Use a DEPTH trigger.




Use a Queue Depth High Event...
Back to top
View user's profile Send private message
rmalghan
PostPosted: Wed Apr 08, 2009 11:36 am    Post subject: Reply with quote

Newbie

Joined: 09 May 2008
Posts: 8

Could you please help me understand what this means. Does this mean the MQ server will generate a message and insert into the same que when the que depth exceeds a threshold or does it put an event into another system que.
mqjeff wrote:
Vitor wrote:
rmalghan wrote:
I can get notified when the number of messages exceed a threshold number.


Use a DEPTH trigger.




Use a Queue Depth High Event...
Back to top
View user's profile Send private message
mqjeff
PostPosted: Wed Apr 08, 2009 11:38 am    Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

It puts an event message on a system event queue, that you can read.

There are SupportPacs that will give you sample code for reading these messages.

See the top of this page for more help.
Back to top
View user's profile Send private message
PeterPotkay
PostPosted: Wed Apr 08, 2009 11:40 am    Post subject: Reply with quote

Poobah

Joined: 15 May 2001
Posts: 7722

rmalghan wrote:
I want to write a small script which will count the messages in the ques so I can get notified when the number of messages exceed a threshold number.

Or talk to your MQ Admin, and ask them to configure their MQ Monitoring tool to watch your queue and alert you when the conditions are satisfied to raise an alert.
_________________
Peter Potkay
Keep Calm and MQ On
Back to top
View user's profile Send private message
Vitor
PostPosted: Wed Apr 08, 2009 1:05 pm    Post subject: Reply with quote

Grand High Poobah

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

rmalghan wrote:
Could you please help me understand what this means. Does this mean the MQ server will generate a message and insert into the same que when the que depth exceeds a threshold or does it put an event into another system que.
mqjeff wrote:
Vitor wrote:
rmalghan wrote:
I can get notified when the number of messages exceed a threshold number.


Use a DEPTH trigger.




Use a Queue Depth High Event...




But it's perhaps easier for a self-confessed newbie to start a triggered application than interpret an event message.
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
mqjeff
PostPosted: Wed Apr 08, 2009 1:18 pm    Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

Vitor wrote:
But it's perhaps easier for a self-confessed newbie to start a triggered application than interpret an event message.


It's perhaps easier for a self-confessed newbie to do a lot of things than it is for them to do the right thing.
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 » Newbie: get a count of number of messages in a que
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.