| Author | 
		  Message
		 | 
		
		  | rmalghan | 
		  
		    
			  
				 Posted: Wed Apr 08, 2009 10:12 am    Post subject: Newbie: get a count of number of messages in a que | 
				     | 
			   
			 
		   | 
		
		
		   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 | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | mqjeff | 
		  
		    
			  
				 Posted: Wed Apr 08, 2009 10:13 am    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		   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 | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | rmalghan | 
		  
		    
			  
				 Posted: Wed Apr 08, 2009 10:21 am    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		   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 | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | Vitor | 
		  
		    
			  
				 Posted: Wed Apr 08, 2009 11:14 am    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		    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 | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | mqjeff | 
		  
		    
			  
				 Posted: Wed Apr 08, 2009 11:15 am    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		   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 | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | rmalghan | 
		  
		    
			  
				 Posted: Wed Apr 08, 2009 11:36 am    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		   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 | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | mqjeff | 
		  
		    
			  
				 Posted: Wed Apr 08, 2009 11:38 am    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		   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 | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | PeterPotkay | 
		  
		    
			  
				 Posted: Wed Apr 08, 2009 11:40 am    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		    Poobah
 
 Joined: 15 May 2001 Posts: 7723
  
  | 
		  
		    
			  
				
   
	| 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 | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | Vitor | 
		  
		    
			  
				 Posted: Wed Apr 08, 2009 1:05 pm    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		    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 | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | mqjeff | 
		  
		    
			  
				 Posted: Wed Apr 08, 2009 1:18 pm    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		   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 | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | 
		    
		   |