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 » Using MQCMD_INQUIRE_Q to obtain enqueue count statistic

Post new topic  Reply to topic
 Using MQCMD_INQUIRE_Q to obtain enqueue count statistic « View previous topic :: View next topic » 
Author Message
iandow
PostPosted: Fri Sep 19, 2008 7:24 am    Post subject: Using MQCMD_INQUIRE_Q to obtain enqueue count statistic Reply with quote

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
View user's profile Send private message
mqjeff
PostPosted: Fri Sep 19, 2008 7:36 am    Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

http://publib.boulder.ibm.com/infocenter/wmqv7/v7r0/index.jsp?topic=/com.ibm.mq.csqzac.doc/pc13000_.htm



http://publib.boulder.ibm.com/infocenter/wmqv7/v7r0/index.jsp?topic=/com.ibm.mq.csqzac.doc/pc13180_.htm



http://publib.boulder.ibm.com/infocenter/wmqv7/v7r0/index.jsp?topic=/com.ibm.mq.csqzac.doc/pc13910_.htm

Back to top
View user's profile Send private message
iandow
PostPosted: Mon Oct 06, 2008 4:33 pm    Post subject: Thanks. Reply with quote

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
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 » Using MQCMD_INQUIRE_Q to obtain enqueue count statistic
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.