| Author | 
		  Message
		 | 
		
		  | Sridevi | 
		  
		    
			  
				 Posted: Mon Aug 08, 2005 8:01 am    Post subject: Getting the count of all messages passing through a queue | 
				     | 
			   
			 
		   | 
		
		
		   Newbie
 
 Joined: 08 Aug 2005 Posts: 6
  
  | 
		  
		    
			  
				Hi,
 
 
We have a requirement to get the count of all messages passing through a queue since the start of a server.
 
 
can somebody explain if there is any way for getting the count?
 
 
Sridevi. | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | jefflowrey | 
		  
		    
			  
				 Posted: Mon Aug 08, 2005 8:12 am    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		   Grand Poobah
 
 Joined: 16 Oct 2002 Posts: 19981
  
  | 
		  
		    
			  
				There's no way to get "the start of a server" from the MQ API, that I know of.
 
 
What is the purpose of the requirement? _________________ I am *not* the model of the modern major general. | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | wschutz | 
		  
		    
			  
				 Posted: Mon Aug 08, 2005 8:19 am    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		    Jedi Knight
 
 Joined: 02 Jun 2005 Posts: 3316 Location: IBM (retired) 
  | 
		  
		    
			  
				Ycan use the pcf message "reset queue statistics" to get the number of enqueue's (mqputs) and dequeue's (mqgets) since either (a) the qmgr started or (b) the last reset you did.  Since doing the "reset" resets the counts to zero, you'd have to keep track of the numbers yourself. _________________ -wayne | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | Sridevi | 
		  
		    
			  
				 Posted: Mon Aug 08, 2005 8:23 am    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		   Newbie
 
 Joined: 08 Aug 2005 Posts: 6
  
  | 
		  
		    
			  
				We need to monitor the messages passing through each and every queue everyday to find the load of the queue  and to generate a report . 
 
 
Is there any possibility of getting the messages passing through a queue after the restart of a queue manager. | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | Sridevi | 
		  
		    
			  
				 Posted: Mon Aug 08, 2005 8:35 am    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		   Newbie
 
 Joined: 08 Aug 2005 Posts: 6
  
  | 
		  
		    
			  
				Hi,
 
 
I'm very new to MQ . Can you please throw some light on pcf message and "reset queue statistics" or provide me some links for that.
 
 
Sridevi | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | vennela | 
		  
		    
			  
				 Posted: Mon Aug 08, 2005 9:30 am    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		    Jedi Knight
 
 Joined: 11 Aug 2002 Posts: 4055 Location: Hyderabad, India 
  | 
		  
		    
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | wschutz | 
		  
		    
			  
				 Posted: Mon Aug 08, 2005 9:55 am    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		    Jedi Knight
 
 Joined: 02 Jun 2005 Posts: 3316 Location: IBM (retired) 
  | 
		  
		    
			  
				If you're a java programmer, download supportpac MS0B (from vennela's link above), and modify the middle part of the sample "PCFMessageListQueueDepth.java" to do this instead:
 
   
	| Code: | 
   
  
	
 
         // Build the request
 
 
         request = new PCFMessage (CMQCFC.MQCMD_RESET_Q_STATS);
 
         request.addParameter (CMQC.MQCA_Q_NAME, "TEST");
 
      //   request.addParameter (CMQC.MQIA_Q_TYPE, CMQC.MQQT_LOCAL);
 
 
         // Use the agent to send the request
 
 
         System.out.print ("Sending PCF request... ");
 
         responses = agent.send (request);
 
         System.out.println ("Received reply.");
 
 
         // Display the results
 
 
         for (int i = 0; i < responses.length; i++)
 
         {
 
            String       name = responses [i].getStringParameterValue (CMQC.MQCA_Q_NAME);
 
            int       deq = responses [i].getIntParameterValue (CMQC.MQIA_MSG_DEQ_COUNT);
 
            int       enq = responses [i].getIntParameterValue (CMQC.MQIA_MSG_ENQ_COUNT);
 
 
            System.out.println ("Queue " + name + " enqueues " + enq + " dequeues " + deq);
 
         }
 
 
 | 
   
 
 _________________ -wayne | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | wschutz | 
		  
		    
			  
				 Posted: Mon Aug 08, 2005 4:55 pm    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		    Jedi Knight
 
 Joined: 02 Jun 2005 Posts: 3316 Location: IBM (retired) 
  | 
		  
		    
			  
				Or, if you're a perl programmer, download the perl MQSeries module ( http://search.cpan.org/~hbiersma/MQSeries-1.23/MQSeries.pm )
 
 
and code this:
 
   
	| Code: | 
   
  
	#!/usr/bin/perl
 
use MQSeries;
 
use MQSeries::Command;
 
 
my $command = MQSeries::Command->new
 
               (
 
                 QueueManager => "TEST"
 
                )
 
                  or die("Unable to instantiate command object\n");
 
my $attr = $command->ResetQueueStatistics
 
            (
 
              QName          => 'TEST'
 
            );
 
 
foreach my $key ( sort keys %$attr ) {
 
      print "\t$key => $attr->{$key}\n";
 
}
 
 
 | 
   
 
 _________________ -wayne | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | 
		    
		   |