Author |
Message
|
luck1610 |
Posted: Mon Aug 09, 2010 6:15 am Post subject: How to use JAVA PCF to get MQ Queue last message Get time |
|
|
Newbie
Joined: 09 Aug 2010 Posts: 2
|
Hi,
I am writing PCF in Java code to perform day to day administration task. I am getting problem in one of my module.
I want to retrieved queues status on Last message GET and PUT time.
I wrote below code but it is giving error. If anyone having sample code to accomplish above task then please help.
PCFMessage request2;
PCFMessage [] responses2;
request2 = new PCFMessage(CMQCFC.MQCMD_INQUIRE_Q_STATUS);
request2.addParameter (CMQC.MQCA_Q_NAME, "*");
request2.addParameter (CMQC.MQIA_Q_TYPE, CMQC.MQQT_LOCAL);
request2.addParameter (CMQCFC.MQIACF_Q_STATUS, new int[]{CMQC.MQCA_Q_NAME, CMQCFC.MQCACF_LAST_GET_TIME});
responses2 = agent.send (request2);
// Display the results
for (int k = 0; k < responses2.length; k++)
{
String name2 = responses2[k].getStringParameterValue (CMQC.MQCA_Q_NAME);
int time = responses2[k].getIntParameterValue (CMQCFC.MQCACF_LAST_GET_TIME );
if(!name2.startsWith("SYSTEM.") )
{
out.write( "time " + "\t"+ time );
out.newLine();
}
} |
|
Back to top |
|
 |
mqjeff |
Posted: Mon Aug 09, 2010 6:21 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
"it is giving an error" means "you have not performed proper troubleshooting".
We can't help you with "it is giving an error".
Please explain in detail what the error is. |
|
Back to top |
|
 |
luck1610 |
Posted: Mon Aug 09, 2010 6:25 am Post subject: |
|
|
Newbie
Joined: 09 Aug 2010 Posts: 2
|
It is giving following error
================
Exception in thread "main" java.lang.ClassCastException: java.lang.String
at com.ibm.mq.pcf.PCFMessage.getIntParameterValue(PCFMessage.java:427)
at PCFMessageListQueueDepth.main(PCFMessageListQueueDepth.java:131)
================
at below line of code.
int time = responses2[k].getIntParameterValue (CMQCFC.MQCACF_LAST_GET_TIME ); |
|
Back to top |
|
 |
joebuckeye |
Posted: Mon Aug 09, 2010 10:14 am Post subject: |
|
|
 Partisan
Joined: 24 Aug 2007 Posts: 365 Location: Columbus, OH
|
You need to look into the type of the data you are requesting.
It is not what you think it is. |
|
Back to top |
|
 |
mqjeff |
Posted: Mon Aug 09, 2010 11:05 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
joebuckeye wrote: |
You need to look into the type of the data you are requesting.
It is not what you think it is. |
Anything that is identified by an MQCACF is a character value. Anything identified by an MQIACF is an integer value.
Oddly enough, that's what the I and the C stand for. |
|
Back to top |
|
 |
|