| Author | 
		  Message
		 | 
		
		  | kobold27 | 
		  
		    
			  
				 Posted: Fri Dec 15, 2006 6:27 am    Post subject: Need help for extracting queue statistics | 
				     | 
			   
			 
		   | 
		
		
		   Newbie
 
 Joined: 15 Dec 2006 Posts: 4
  
  | 
		  
		    
			  
				Hi,
 
I want to retrieve the time of the oldest message in a queue, for now i can browse the entire queue and check each message timestamps, but if i refer to MQ Explorer, it's possible to activate statistics on my queue and get the "the age in seconds of the oldest message on the queue". I have done a lot of research and tried a lot of crazy thing, but i still dont figure how to do this, ive tried to use code like that:
 
 
          request = new PCFMessage (CMQCFC.MQCMD_INQUIRE_Q);
 
          request.addParameter(CMQC.MQCA_Q_NAME, targetName);
 
 
Code runs great, but when i check the values of the returned list, i dont see anything that looks like the value i need ! | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | Vitor | 
		  
		    
			  
				 Posted: Fri Dec 15, 2006 6:29 am    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		    Grand High Poobah
 
 Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA 
  | 
		  
		    
			  
				If your queue is FIFO, you can browse the 1st message & obtain the put time.... _________________ Honesty is the best policy.
 
Insanity is the best defence. | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | wschutz | 
		  
		    
			  
				 Posted: Fri Dec 15, 2006 6:34 am    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		    Jedi Knight
 
 Joined: 02 Jun 2005 Posts: 3316 Location: IBM (retired) 
  | 
		  
		    
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | kobold27 | 
		  
		    
			  
				 Posted: Fri Dec 15, 2006 6:37 am    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		   Newbie
 
 Joined: 15 Dec 2006 Posts: 4
  
  | 
		  
		    
			  
				you're 100% right, i didn't think about that... 
 
 
Thanks | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | kobold27 | 
		  
		    
			  
				 Posted: Fri Dec 15, 2006 6:40 am    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		   Newbie
 
 Joined: 15 Dec 2006 Posts: 4
  
  | 
		  
		    
			  
				| If my message is 8 meg, is the whole 8 megs transfered when i browse message? | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | Vitor | 
		  
		    
			  
				 Posted: Fri Dec 15, 2006 6:48 am    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		    Grand High Poobah
 
 Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA 
  | 
		  
		    
			  
				
   
	| kobold27 wrote: | 
   
  
	| If my message is 8 meg, is the whole 8 megs transfered when i browse message? | 
   
 
 
 
You can browse with a small buffer & ACCEPT_TRUNCATED_MESSAGE if all you want is the MQMD.
 
 
 
Using PCF is the better solution because it works for queues that deliver by priority. Browsing's easier, quicker but dirtier.    _________________ Honesty is the best policy.
 
Insanity is the best defence. | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | kobold27 | 
		  
		    
			  
				 Posted: Fri Dec 15, 2006 7:14 am    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		   Newbie
 
 Joined: 15 Dec 2006 Posts: 4
  
  | 
		  
		    
			  
				Thanks for your fast anwser, i was using an old PCF library and didnt have the CMQCFC.MQCMD_INQUIRE_Q_STATUS in... So i switched to a recent one and all is working properly...
 
 
Here is my code if it can help someone else:
 
 
           // Connect a PCFAgent to the specified queue manager
 
           PCFMessageAgent agent = new PCFMessageAgent ("localhost", 1414, "CHANNEL1");
 
 
           System.out.println ("Connected.");
 
 
           // Build the request
 
           PCFMessage request = new PCFMessage (CMQCFC.MQCMD_INQUIRE_Q_STATUS);
 
           request.addParameter (CMQC.MQCA_Q_NAME, "CHANNEL.TEST");
 
 
           // Use the agent to send the request
 
           System.out.print ("Sending PCF request... ");
 
           PCFMessage [] responses = agent.send (request);
 
           System.out.println ("Received reply.");
 
 
           // Display the results
 
           for (int i = 0; i < responses.length; i++)
 
           {
 
              if (responses [i].getCompCode() == MQException.MQCC_OK)
 
              {
 
                 String      name = responses [i].getStringParameterValue (CMQC.MQCA_Q_NAME);
 
                 int      maxAge = responses [i].getIntParameterValue (MQCFIN.MQIACF_OLDEST_MSG_AGE);
 
                 System.out.println ("Queue " + name + " Max Age: " + maxAge);
 
              }
 
 
           } | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | jefflowrey | 
		  
		    
			  
				 Posted: Fri Dec 15, 2006 8:11 am    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		   Grand Poobah
 
 Joined: 16 Oct 2002 Posts: 19981
  
  | 
		  
		    
			  
				This will only work for MQ v6. _________________ I am *not* the model of the modern major general. | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | 
		    
		   |