|
RSS Feed - WebSphere MQ Support
|
RSS Feed - Message Broker Support
|
 |
|
Using MQCMD_INQUIRE_Q to obtain enqueue count statistic |
« View previous topic :: View next topic » |
Author |
Message
|
iandow |
Posted: Fri Sep 19, 2008 7:24 am Post subject: Using MQCMD_INQUIRE_Q to obtain enqueue count statistic |
|
|
Newbie
Joined: 19 Sep 2008 Posts: 2
|
I'm trying to obtain the MQIA_MSG_ENQ_COUNT enqueue statistic with the command,
Code: |
agent.send (CMQCFC.MQCMD_INQUIRE_Q, parameters); |
However, I can't seem to get this statistic in the resulting MQCFH object no matter how I define the parameters. Could someone please recommend how I need to define the parameters variable in order to obtain this statistic for every queue?
Here's my full code, but it produces a PCF error:
Code: |
import com.ibm.mq.pcf.*;
import com.ibm.mq.MQMessage;
import com.ibm.mq.MQException;
import java.io.IOException;
public class QueryTests {
public static void main (String [] args)
{
PCFAgent agent;
PCFParameter[] parameters =
{
new MQCFST(CMQC.MQCA_Q_NAME, "*"),
new MQCFST(CMQC.MQIA_MSG_ENQ_COUNT, "*")
};
MQMessage[] responses;
MQCFH cfh;
PCFParameter p;
String name = null;
Integer depth = null;
try
{
// Connect a PCFAgent to the specified queue manager
agent = new PCFAgent (args [0]);
System.out.println ("Connected.");
// Use the agent to send the request
System.out.print ("Sending PCF request... ");
responses = agent.send (CMQCFC.MQCMD_INQUIRE_Q, parameters);
System.out.println ("Received reply.");
for (int i = 0; i < responses.length; i++)
{
cfh = new MQCFH (responses [i]);
// Check the PCF header (MQCFH) in the response message
if (cfh.reason == 0)
{
for (int j = 0; j < cfh.parameterCount; j++)
{
p = PCFParameter.nextParameter (responses [i]);
// Extract what we want from the returned attributes
int parameter = p.getParameter ();
if (parameter == CMQC.MQIA_MSG_ENQ_COUNT) {
Integer enq_count = (Integer)p.getValue();
System.out.println("!!!!!!! MQIA_MSG_ENQ_COUNT = " + enq_count);
}
}
}
else
{
System.out.println ("PCF error:\n" + cfh);
// Walk through the returned parameters describing the error
for (int j = 0; j < cfh.parameterCount; j++)
{
System.out.println (PCFParameter.nextParameter (responses [0]));
}
}
}
// Disconnect
System.out.print ("Disconnecting... ");
agent.disconnect ();
System.out.println ("Done.");
}
catch (ArrayIndexOutOfBoundsException abe)
{
System.out.println ("Usage: \n" +
"\tjava ListQueueDepth queue-manager\n" +
"\tjava ListQueueDepth host port channel");
}
catch (NumberFormatException nfe)
{
System.out.println ("Invalid port: " + args [1]);
System.out.println ("Usage: \n" +
"\tjava ListQueueDepth queue-manager\n" +
"\tjava ListQueueDepth host port channel");
}
catch (MQException mqe)
{
System.err.println (mqe);
}
catch (IOException ioe)
{
System.err.println (ioe);
}
}
}
|
Thanks a lot,
Ian |
|
Back to top |
|
 |
mqjeff |
Posted: Fri Sep 19, 2008 7:36 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
|
Back to top |
|
 |
iandow |
Posted: Mon Oct 06, 2008 4:33 pm Post subject: Thanks. |
|
|
Newbie
Joined: 19 Sep 2008 Posts: 2
|
After reading those links, I understand that I have to use the MQCMD_RESET_Q_STATS command to get the enqueue and dequeue statistics.
Thanks for your help. |
|
Back to top |
|
 |
|
|
 |
|
Page 1 of 1 |
|
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
|
|
|
|