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 » Querying queue attribute using Java API

Post new topic  Reply to topic
 Querying queue attribute using Java API « View previous topic :: View next topic » 
Author Message
yeshwanthpartapu
PostPosted: Wed Apr 16, 2014 1:39 am    Post subject: Querying queue attribute using Java API Reply with quote

Newbie

Joined: 06 Mar 2014
Posts: 3

Code:
import java.io.*;
import com.ibm.mq.*;
import com.ibm.mq.pcf.*;

public class sample23 {
   public static void main(String[] args) throws MQException {
      try {
         PCFAgent agent = new PCFAgent("JAVAAPI");

         
         String[] strings = { "test" };
      
         PCFParameter[] pcfParameters = { new MQCFSL(2016, strings), new MQCFIN(1002, 1009) };
         //2016=MQCA_Q_NAME
         //1002=MQIACF_Q_ATTRS 1009=MQIACF_ALL
         
         
         MQMessage[] responses = agent.send(41, pcfParameters);
         MQCFH mqCFH = new MQCFH(responses[1]);
         PCFParameter pcfParam;
      
         

         
         if (mqCFH.getReason() == 0) {
            for (int index = 0; index < mqCFH.getParameterCount(); index++) {
               // Walk through the returned attributes.
               pcfParam = PCFParameter.nextParameter(responses[0]);
               System.out.println(pcfParam.getParameterName());
               System.out.println(pcfParam.getValue());
            }
         }
      } catch (PCFException pcfe) {
         System.err.println("PCF error: " + pcfe);
      } catch (MQException mqe) {
         System.err.println(mqe);
      } catch (IOException ioe) {
         System.err.println(ioe);
      }
   }
}




while running the code i am not able get any output
mqCFH.getReason is returning 3008 as response
could you please help me out on this
Back to top
View user's profile Send private message
RogerLacroix
PostPosted: Wed Apr 16, 2014 12:44 pm    Post subject: Re: Querying queue attribute using Java API Reply with quote

Jedi Knight

Joined: 15 May 2001
Posts: 3253
Location: London, ON Canada

yeshwanthpartapu wrote:
Code:
PCFAgent agent = new PCFAgent("JAVAAPI");

String[] strings = { "test" };

PCFParameter[] pcfParameters = { new MQCFSL(2016, strings), new MQCFIN(1002, 1009) };
//2016=MQCA_Q_NAME
//1002=MQIACF_Q_ATTRS 1009=MQIACF_ALL

MQMessage[] responses = agent.send(41, pcfParameters);

I have some comments:

- What's with using the numeric values? Why aren't you using the MQ defines? What, did you decompile someone's code and try and use it - really, really weird. Why don't you look at the various Java PCF samples on the internet? i.e. ListQueueDepth.java

- Is "JAVAAPI" the name of queue manager? Doesn't look like a queue manager name to me!!

- If "JAVAAPI" is the name of your queue manager then does the queue called "test" actually exist?

Here's some code snippets from ListQueueDepth.java:
i.e.
Code:
int []  attrs =
         {
            CMQC.MQCA_Q_NAME,
            CMQC.MQIA_CURRENT_Q_DEPTH
         };
PCFParameter []  parameters =
         {
            new MQCFST (CMQC.MQCA_Q_NAME, "*"),
            new MQCFIN (CMQC.MQIA_Q_TYPE, CMQC.MQQT_LOCAL),
            new MQCFIL (CMQCFC.MQIACF_Q_ATTRS, attrs)
         };

and
Code:
responses = agent.send (CMQCFC.MQCMD_INQUIRE_Q, parameters);

Regards,
Roger Lacroix
Capitalware Inc.
_________________
Capitalware: Transforming tomorrow into today.
Connected to MQ!
Twitter
Back to top
View user's profile Send private message Visit poster's website
yeshwanthpartapu
PostPosted: Mon Apr 21, 2014 11:24 pm    Post subject: Reply with quote

Newbie

Joined: 06 Mar 2014
Posts: 3

hi

JAVAAPI is Queue Manager name...
test queue exists in JAVAAPI QM....

if i use this
new MQCFST (CMQC.MQCA_Q_NAME, "*")

i am getting CMQC as deprecated ... so i am using constant field values...
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Tue Apr 22, 2014 4:36 am    Post subject: Reply with quote

Grand High Poobah

Joined: 18 Nov 2003
Posts: 20696
Location: LI,NY

If you are getting CMQC as deprecated you should probably be using the MQConstants class instead ...
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » IBM MQ Java / JMS » Querying queue attribute using Java API
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.