|
RSS Feed - WebSphere MQ Support
|
RSS Feed - Message Broker Support
|
 |
|
Get Q_Time using MS0B |
« View previous topic :: View next topic » |
Author |
Message
|
KIT_INC |
Posted: Wed May 25, 2011 7:48 am Post subject: Get Q_Time using MS0B |
|
|
Knight
Joined: 25 Aug 2006 Posts: 589
|
I am trying to get the Q time of a queue using NS0B.
My java program is a modification of the PCFMessageListQueueDepth.java example
The request code is like
request = new PCFMessage (CMQCFC.MQCMD_INQUIRE_Q_STATUS);
request.addParameter (CMQC.MQCA_Q_NAME, "Bug");
request.addParameter (CMQCFC.MQIACF_Q_STATUS_ATTRS, CMQCFC.MQIACF_ALL);
To display the result, I have
// Display the results
for (int i = 0; i < responses.length; i++)
{
String name = responses [i].getStringParameterValue (CMQC.MQCA_Q_NAME);
String pdate = responses [i].getStringParameterValue (CMQCFC.MQCACF_LAST_PUT_DATE);
int qtime = responses [i].getIntParameterValue (CMQCFC.MQIACF_Q_TIME_INDICATOR);
System.out.println (name + pdate + qtime );
}
When I execute the program, I got
Exception in thread "main" java.lang.ClassCastException: [I cannot be cast to java.lang.Integer
If I remove
int qtime = responses [i].getIntParameterValue (CMQCFC.MQIACF_Q_TIME_INDICATOR);
amd also qtime from the println, it works.
I know very little about Java. Can anyone help me on this.
Forget to mentioned that I am actually using the Jar file of MQ V7 on Windows. So the subject of this entry is not quite correct. I am just using a modified sample program and the PCF agent (I think it is part of MS0b) from MS0B. |
|
Back to top |
|
 |
fjb_saper |
Posted: Wed May 25, 2011 8:47 pm Post subject: Re: Get Q_Time using MS0B |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
KIT_INC wrote: |
When I execute the program, I got
Exception in thread "main" java.lang.ClassCastException: [I cannot be cast to java.lang.Integer
If I remove
int qtime = responses [i].getIntParameterValue (CMQCFC.MQIACF_Q_TIME_INDICATOR);
amd also qtime from the println, it works.
I know very little about Java. Can anyone help me on this.
|
Have you tried:
Code: |
int qtime = responses [i].getIntParameterValue (CMQCFC.MQIACF_Q_TIME_INDICATOR).getIntValue(); |
or something of the kind. Looks to me like the output is an Integer and not an int.  _________________ MQ & Broker admin |
|
Back to top |
|
 |
KIT_INC |
Posted: Thu May 26, 2011 5:33 am Post subject: |
|
|
Knight
Joined: 25 Aug 2006 Posts: 589
|
Hi fjb_saper, thanks a lot for the pointer.
Yes, you are right CMQCFC.MQIACF_Q_TIME_INDICATOR is not an integer value. Instead it is a list (MQCFIL). I changed the code to
int[] qtime = responses [i].getIntListParameterValue (CMQCFC.MQIACF_Q_TIME_INDICATOR);
The code now seems to work except that it is returning some strange value.
QTIME on the console output shows [I@1194a4e
When I use MQ Explorer to look at the status of the queue 'Bug'
queue time is 100651116,100651116
I expect getIntListParameterValue to give me an array of integers. |
|
Back to top |
|
 |
mqjeff |
Posted: Thu May 26, 2011 6:03 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
it's likely giving you an array of Integer object, rather than int values. |
|
Back to top |
|
 |
KIT_INC |
Posted: Thu May 26, 2011 7:24 am Post subject: |
|
|
Knight
Joined: 25 Aug 2006 Posts: 589
|
Thanks for all the help. I got it to work
qtime is an array and I used println to print qtime to the console. So it shows strange.
When I use Arrays.toString(qtime) to print. It shows the right value. |
|
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
|
|
|
|