Author |
Message
|
saini |
Posted: Sun Oct 26, 2003 3:17 pm Post subject: Having problems with INQUIRE_Q_STATUS using PCFMessageAgent |
|
|
Novice
Joined: 28 Feb 2002 Posts: 24
|
My Command server crashes when I run the following code to discover the Queue Status. I have successfully ran other PCF commands without any issues? Can someone help me and let me know what I am doing wrong in this code. Thanks! I am running on Windows XP with mq 5.3.0.4.
PCFMessageAgent agent = null;
try {
agent = new PCFMessageAgent("MYQM7");
PCFMessage request = new PCFMessage(CMQCFC.MQCMD_INQUIRE_Q_STATUS);
request.addParameter(CMQC.MQCA_Q_NAME, "MY.*");
request.addParameter(CMQCFC.MQIACF_Q_STATUS_TYPE, CMQCFC.MQIACF_Q_HANDLE);
PCFMessage[] responses = agent.send(request, true);
for (int i=0; i < responses.length; i++)
{
int openInputHandles = responses[i].getIntParameterValue(CMQC.MQIA_OPEN_INPUT_COUNT);
int openOutputHandles = responses[i].getIntParameterValue(CMQC.MQIA_OPEN_OUTPUT_COUNT);
int currentDepth = responses[i].getIntParameterValue(CMQC.MQIA_CURRENT_Q_DEPTH);
System.out.println("Input:"+openInputHandles+" Output:"+ openOutputHandles + " CurDepth:" + currentDepth);
}
agent.disconnect();
} catch (PCFException pcfe) {
System.err.println("PCF error: " + pcfe);
} catch (MQException mqe) {
System.err.println(mqe);
} catch (IOException ioe) {
System.err.println(ioe);
} |
|
Back to top |
|
 |
clindsey |
Posted: Mon Oct 27, 2003 3:05 pm Post subject: |
|
|
Knight
Joined: 12 Jul 2002 Posts: 586 Location: Dallas, Tx
|
Saini,
FWIIW, I ran your code on my Win/2000 workstation and it ran just fine for me. Do you get and FDC files in <mqdir>\errors when the command server dies?
Charlie |
|
Back to top |
|
 |
saini |
Posted: Tue Oct 28, 2003 4:19 pm Post subject: |
|
|
Novice
Joined: 28 Feb 2002 Posts: 24
|
I did not see any FDC files. Wonder if this problem is specific to XP. However, I did resolve my issue by adding some more parameters to the request. Problem is resolved for now.
Thanks for all you help.
regards,
-N |
|
Back to top |
|
 |
Drfischer |
Posted: Mon Jan 26, 2004 6:49 pm Post subject: |
|
|
 Newbie
Joined: 26 Jan 2004 Posts: 3
|
Dear sirs,
I have been trying to get this snip of code to work with MQ5.3 on linux and for the life of me I can't not get it to respond other then a error code 2033.
I have just wraped the code snipit in a main function and it keeps hanging on the send. Any info on how to get the "INQUIRE_Q_STATUS" to work would be very helpfull
Also found out that that command server is crashing with this snipit
thanks |
|
Back to top |
|
 |
clindsey |
Posted: Tue Jan 27, 2004 6:28 am Post subject: |
|
|
Knight
Joined: 12 Jul 2002 Posts: 586 Location: Dallas, Tx
|
A common cause of 2033 after sending pcf messages is that the command server is not running.
Run 'dspmqcsv QMGRNAME' to get the status. If it is not active, start it with 'strmqcsv QMGRNAME'. You can omit QMGRNAME if it is the default queue manager.
Charlie |
|
Back to top |
|
 |
Drfischer |
Posted: Tue Jan 27, 2004 7:14 am Post subject: |
|
|
 Newbie
Joined: 26 Jan 2004 Posts: 3
|
clindsey,
thank you for your reply.
I am finding that the code is crashing my command server. If you have and code examples of INQUIRE_Q_STATUS that would be great. I can post my sample if you would like also..
thanks |
|
Back to top |
|
 |
clindsey |
Posted: Tue Jan 27, 2004 12:06 pm Post subject: |
|
|
Knight
Joined: 12 Jul 2002 Posts: 586 Location: Dallas, Tx
|
The only sample I have is C code. You can get it from http://www.developer.ibm.com/tech/sampmq.html
Look for qstatus.c
The command attributes are the same so you can adapt if fairly easily to java if needed.
I would also try removing all messages from SYSTEM.ADMIN.COMMAND.QUEUE before starting the command server to remove any bad messages that may be hanging around there.
Charlie |
|
Back to top |
|
 |
saini |
Posted: Tue Jan 27, 2004 5:48 pm Post subject: |
|
|
Novice
Joined: 28 Feb 2002 Posts: 24
|
OK here is another sample that works on LINUX.
try
{
PCFMessage request = new PCFMessage(CMQCFC.MQCMD_INQUIRE_Q_STATUS);
request.addParameter(CMQC.MQCA_Q_NAME, "MY.QUEUE");
request.addParameter(CMQCFC.MQIACF_Q_ATTRS, new int[] {CMQCFC.MQIACF_ALL});
PCFMessage[] responses = agent.send(request);
for (int i = 0; i < responses.length; i++)
{
String queue =
responses[i].getStringParameterValue(CMQC.MQCA_Q_NAME).trim();
int inputHandles = responses[i].getIntParameterValue(CMQC.MQIA_OPEN_INPUT_COUNT);
int outputHandles = responses[i].getIntParameterValue(CMQC.MQIA_OPEN_OUTPUT_COUNT);
int curdepth = responses[i].getIntParameterValue(CMQC.MQIA_CURRENT_Q_DEPTH);
System.out.println("Input:"+inputHandles +" Output:"+ outputHandles + " CurDepth:" + curdepth ); }
}
catch (PCFException pcfe)
{
System.err.println("PCF error: " + pcfe);
}
catch (MQException mqe)
{
System.err.println(mqe);
}
Hope this helps !!!!
rgds,
-S |
|
Back to top |
|
 |
Drfischer |
Posted: Wed Jan 28, 2004 6:39 am Post subject: |
|
|
 Newbie
Joined: 26 Jan 2004 Posts: 3
|
Thanks!!! that work perfectly.
Now I guess I need to figure why the top example did not work
thanks again |
|
Back to top |
|
 |
|