Author |
Message
|
johnrw |
Posted: Thu Mar 18, 2004 12:29 pm Post subject: MQSeries MQINQ but for Java |
|
|
Novice
Joined: 29 Jan 2004 Posts: 12
|
Are there any examples for a Java client to call MQINQ (MQSeries)to get the queue depth or maximum message length from an MVS queue. I can't find any examples.
thanks |
|
Back to top |
|
 |
clindsey |
Posted: Thu Mar 18, 2004 1:02 pm Post subject: |
|
|
Knight
Joined: 12 Jul 2002 Posts: 586 Location: Dallas, Tx
|
John,
here is a code snippet for you that should help.
Code: |
if (hostName != null)
{
MQEnvironment.hostname = hostName;
MQEnvironment.channel = channel;
MQEnvironment.port = port;
}
MQQueueManager qMgr = new MQQueueManager(qMgrName);
int openOptions = MQC.MQOO_OUTPUT | // for put access
MQC.MQOO_INQUIRE | // check q depth
MQC.MQOO_INPUT_AS_Q_DEF | // for get access
MQC.MQOO_FAIL_IF_QUIESCING; // break on endmqm
MQQueue outQ = qMgr.accessQueue(qName,
openOptions,
null, // default q manager
null, // no dynamic q name
null); // no alternate user id
int curDepth = outQ.getCurrentDepth();
System.out.println("Current depth: " + curDepth);
|
If you really need a complete program, let me know and I can email you one.
There is also MQQueue method getMaximumMessageLength along with others for just about all the queue attributes.
Charlie |
|
Back to top |
|
 |
johnrw |
Posted: Thu Mar 18, 2004 1:10 pm Post subject: |
|
|
Novice
Joined: 29 Jan 2004 Posts: 12
|
Beauty, that looks it it might work, I'll try it out.
Do you also happen to have the length parameter? ie
would it be: getMaxMessageLength ?? |
|
Back to top |
|
 |
johnrw |
Posted: Thu Mar 18, 2004 1:12 pm Post subject: |
|
|
Novice
Joined: 29 Jan 2004 Posts: 12
|
oops, sorry, I missed your line about the length
thanks, I'll try them both |
|
Back to top |
|
 |
johnrw |
Posted: Thu Mar 18, 2004 1:53 pm Post subject: |
|
|
Novice
Joined: 29 Jan 2004 Posts: 12
|
I attempted to get the queue depth from MVS but got a 2038 return code indicating MQRC_NOT_OPEN_FOR_INQUIRE.
Perhaps MVS won't allow it, don't know at this point.
For the
int maxLength = qName.getMaximumMessageLength;
statement, it would not compile because
it is accusing me of attempting to reference it as an
'instance variable'. (although it may not work also for the same
reason as above).
So I'm still batting zero at this point. |
|
Back to top |
|
 |
StefanSievert |
Posted: Thu Mar 18, 2004 2:05 pm Post subject: |
|
|
 Partisan
Joined: 28 Oct 2001 Posts: 333 Location: San Francisco
|
johnrw wrote: |
I attempted to get the queue depth from MVS but got a 2038 return code indicating MQRC_NOT_OPEN_FOR_INQUIRE.
Perhaps MVS won't allow it, don't know at this point.
|
Did you open the queue with MQOO_INQUIRE?
johnrw wrote: |
For the
int maxLength = qName.getMaximumMessageLength;
statement, it would not compile because
it is accusing me of attempting to reference it as an
'instance variable'. (although it may not work also for the same
reason as above).
|
You are simply missing () behind your method name. It should be
Code: |
int maxLength = qName.getMaximumMessageLength(); |
_________________ Stefan Sievert
IBM Certified * WebSphere MQ |
|
Back to top |
|
 |
clindsey |
Posted: Thu Mar 18, 2004 3:50 pm Post subject: |
|
|
Knight
Joined: 12 Jul 2002 Posts: 586 Location: Dallas, Tx
|
John,
Be sure to copy the part above that has all the open option flags:
int openOptions = MQC.MQOO_OUTPUT |
MQC.MQOO_INQUIRE |
MQC.MQOO_INPUT_AS_Q_DEF |
MQC.MQOO_FAIL_IF_QUIESCING;
and then use openOptions in the accessQueue method.
Charlie |
|
Back to top |
|
 |
johnrw |
Posted: Fri Mar 19, 2004 7:17 am Post subject: |
|
|
Novice
Joined: 29 Jan 2004 Posts: 12
|
Alright, I've got both the QUEUE DEPTH and the MAX MESSAGE LENGTH returning now, but I realize it is actually the MESSAGE LENGTH that I need and not the max message length. I tried getMessageLength but it isn't recognized. Do you know the proper method to get this?
Also, is there a URL where these methods can be found?
thanks |
|
Back to top |
|
 |
vennela |
Posted: Fri Mar 19, 2004 8:13 am Post subject: |
|
|
 Jedi Knight
Joined: 11 Aug 2002 Posts: 4055 Location: Hyderabad, India
|
|
Back to top |
|
 |
bower5932 |
Posted: Fri Mar 19, 2004 8:15 am Post subject: |
|
|
 Jedi Knight
Joined: 27 Aug 2001 Posts: 3023 Location: Dallas, TX, USA
|
Try looking at the WebSphere MQ Using Java manual. There is a link to it at the top of the page. |
|
Back to top |
|
 |
johnrw |
Posted: Fri Mar 19, 2004 8:31 am Post subject: |
|
|
Novice
Joined: 29 Jan 2004 Posts: 12
|
This site is great! Thanks for the help. |
|
Back to top |
|
 |
TheViper |
Posted: Mon Jan 22, 2007 1:43 am Post subject: |
|
|
Newbie
Joined: 22 Jan 2007 Posts: 1
|
clindsey wrote: |
John,
Be sure to copy the part above that has all the open option flags:
int openOptions = MQC.MQOO_OUTPUT |
MQC.MQOO_INQUIRE |
MQC.MQOO_INPUT_AS_Q_DEF |
MQC.MQOO_FAIL_IF_QUIESCING;
and then use openOptions in the accessQueue method.
Charlie |
Thanks for the info... This is what I needed for my check as well... Thanks a lot.
Also, thanks to vennela for the manual links... They are handy as well... |
|
Back to top |
|
 |
|