|
RSS Feed - WebSphere MQ Support
|
RSS Feed - Message Broker Support
|
 |
|
Querying queue attribute using Java API |
« View previous topic :: View next topic » |
Author |
Message
|
yeshwanthpartapu |
Posted: Wed Apr 16, 2014 1:39 am Post subject: Querying queue attribute using Java API |
|
|
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 |
|
 |
RogerLacroix |
Posted: Wed Apr 16, 2014 12:44 pm Post subject: Re: Querying queue attribute using Java API |
|
|
 Jedi Knight
Joined: 15 May 2001 Posts: 3264 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 |
|
 |
yeshwanthpartapu |
Posted: Mon Apr 21, 2014 11:24 pm Post subject: |
|
|
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 |
|
 |
fjb_saper |
Posted: Tue Apr 22, 2014 4:36 am Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 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 |
|
 |
|
|
 |
|
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
|
|
|
|