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 » Need help for extracting queue statistics

Post new topic  Reply to topic
 Need help for extracting queue statistics « View previous topic :: View next topic » 
Author Message
kobold27
PostPosted: Fri Dec 15, 2006 6:27 am    Post subject: Need help for extracting queue statistics Reply with quote

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
View user's profile Send private message
Vitor
PostPosted: Fri Dec 15, 2006 6:29 am    Post subject: Reply with quote

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
View user's profile Send private message
wschutz
PostPosted: Fri Dec 15, 2006 6:34 am    Post subject: Reply with quote

Jedi Knight

Joined: 02 Jun 2005
Posts: 3316
Location: IBM (retired)

me thinks you want "inq q stats" pcf:
http://publib.boulder.ibm.com/infocenter/wmqv6/v6r0/index.jsp?topic=/com.ibm.mq.csqzac.doc/pc13190_.htm
_________________
-wayne
Back to top
View user's profile Send private message Send e-mail AIM Address
kobold27
PostPosted: Fri Dec 15, 2006 6:37 am    Post subject: Reply with quote

Newbie

Joined: 15 Dec 2006
Posts: 4

you're 100% right, i didn't think about that...

Thanks
Back to top
View user's profile Send private message
kobold27
PostPosted: Fri Dec 15, 2006 6:40 am    Post subject: Reply with quote

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
View user's profile Send private message
Vitor
PostPosted: Fri Dec 15, 2006 6:48 am    Post subject: Reply with quote

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
View user's profile Send private message
kobold27
PostPosted: Fri Dec 15, 2006 7:14 am    Post subject: Reply with quote

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
View user's profile Send private message
jefflowrey
PostPosted: Fri Dec 15, 2006 8:11 am    Post subject: Reply with quote

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
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 » Need help for extracting queue statistics
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.