| Author | 
		  Message
		 | 
		
		  | HeadOffice | 
		  
		    
			  
				 Posted: Thu Apr 10, 2008 9:45 am    Post subject: Peek & Count???????? | 
				     | 
			   
			 
		   | 
		
		
		    Newbie
 
 Joined: 13 Mar 2008 Posts: 9
  
  | 
		  
		    
			  
				I'm relatively new to MQ but have built a client able to connect, write to, read from and disconnect MQ queues. This has been done in C#.NET.
 
 
My 2 questions are:
 
 
1. Can I "peek" at a message without removing it from a queue - and how?
 
 
2. Can I determine how many messages are on the queue - and how?
 
 
Using the amqmdnet dll I'm hoping the right flags/methods are exposed. Any ideas?
 
 
Many thanks in advance... | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | jefflowrey | 
		  
		    
			  
				 Posted: Thu Apr 10, 2008 9:55 am    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		   Grand Poobah
 
 Joined: 16 Oct 2002 Posts: 19981
  
  | 
		  
		    
			  
				1) Yes.  It's called "browse".
 
 
2) Yes, BUT.  yes, you can do this.  You never want to code a business application to use this, though.  The only thing that has any business thinking about the queue depth is a monitoring/status application.
 
 
Read the queue until it's empty - you get back MQRC_NO_MSG_AVAILABLE.
 
 
You almost certainly don't want to browse the queue either.  You likely want to use syncpoint. _________________ I am *not* the model of the modern major general. | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | HeadOffice | 
		  
		    
			  
				 Posted: Thu Apr 10, 2008 10:01 am    Post subject: Re: Peek & Count | 
				     | 
			   
			 
		   | 
		
		
		    Newbie
 
 Joined: 13 Mar 2008 Posts: 9
  
  | 
		  
		    
			  
				I can't see "Browse" exposed as a method on the queue or queue manager classes. Any ideas where?
 
 
As for Counting - I'd just like to monitor how many messages on the queue.
 
 
Thanks for the advice - if you can point me in the direction of the browse I'd be eternally grateful.
 
 
   | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | jefflowrey | 
		  
		    
			  
				 Posted: Thu Apr 10, 2008 10:31 am    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		   Grand Poobah
 
 Joined: 16 Oct 2002 Posts: 19981
  
  | 
		  
		    
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | PeterPotkay | 
		  
		    
			  
				 Posted: Thu Apr 10, 2008 12:01 pm    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		    Poobah
 
 Joined: 15 May 2001 Posts: 7723
  
  | 
		  
		    
			  
				I know this will sound weird, but the # of messages that you can get can quite often be less than the q depth reports. Its an odd concept for new MQ people, but its been discussed a bunch of times here. Do a quick search for more info. _________________ Peter Potkay
 
Keep Calm and MQ On | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | bruce2359 | 
		  
		    
			  
				 Posted: Thu Apr 10, 2008 1:53 pm    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		    Poobah
 
 Joined: 05 Jan 2008 Posts: 9486 Location: US: west coast, almost. Otherwise, enroute. 
  | 
		  
		    
			  
				A translation:  current depth is the total number of messages in the queue.  If some (or all) are not yet comitted, your app will not be able to mqget them. _________________ I like deadlines. I like to wave as they pass by.
 
ב''ה
 
Lex Orandi, Lex Credendi, Lex Vivendi. As we Worship, So we Believe, So we Live. | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | 
		    
		   |