ASG
IBM
Zystems
Cressida
Icon
Netflexity
 
  MQSeries.net
Search  Search       Tech Exchange      Education      Certifications      Library      Info Center      SupportPacs      LinkedIn  Search  Search                                                                   FAQ  FAQ   Usergroups  Usergroups
 
Register  ::  Log in Log in to check your private messages
 
RSS Feed - WebSphere MQ Support RSS Feed - Message Broker Support

MQSeries.net Forum Index » IBM MQ Java / JMS » MQSeries MQINQ but for Java

Post new topic  Reply to topic
 MQSeries MQINQ but for Java « View previous topic :: View next topic » 
Author Message
johnrw
PostPosted: Thu Mar 18, 2004 12:29 pm    Post subject: MQSeries MQINQ but for Java Reply with quote

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
View user's profile Send private message
clindsey
PostPosted: Thu Mar 18, 2004 1:02 pm    Post subject: Reply with quote

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
View user's profile Send private message
johnrw
PostPosted: Thu Mar 18, 2004 1:10 pm    Post subject: Reply with quote

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
View user's profile Send private message
johnrw
PostPosted: Thu Mar 18, 2004 1:12 pm    Post subject: Reply with quote

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
View user's profile Send private message
johnrw
PostPosted: Thu Mar 18, 2004 1:53 pm    Post subject: Reply with quote

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
View user's profile Send private message
StefanSievert
PostPosted: Thu Mar 18, 2004 2:05 pm    Post subject: Reply with quote

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
View user's profile Send private message
clindsey
PostPosted: Thu Mar 18, 2004 3:50 pm    Post subject: Reply with quote

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
View user's profile Send private message
johnrw
PostPosted: Fri Mar 19, 2004 7:17 am    Post subject: Reply with quote

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
View user's profile Send private message
vennela
PostPosted: Fri Mar 19, 2004 8:13 am    Post subject: Reply with quote

Jedi Knight

Joined: 11 Aug 2002
Posts: 4055
Location: Hyderabad, India

Here are the manuals.

http://www-306.ibm.com/software/integration/mqfamily/library/manualsa/manuals/crosslatest.html

For sample code try the repository on this site or

http://www.developer.ibm.com/tech/sampmq.html
Back to top
View user's profile Send private message Send e-mail Visit poster's website
bower5932
PostPosted: Fri Mar 19, 2004 8:15 am    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail Visit poster's website AIM Address Yahoo Messenger
johnrw
PostPosted: Fri Mar 19, 2004 8:31 am    Post subject: Reply with quote

Novice

Joined: 29 Jan 2004
Posts: 12

This site is great! Thanks for the help.
Back to top
View user's profile Send private message
TheViper
PostPosted: Mon Jan 22, 2007 1:43 am    Post subject: Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » IBM MQ Java / JMS » MQSeries MQINQ but for Java
Jump to:  



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
Protected by Anti-Spam ACP
 
 


Theme by Dustin Baccetti
Powered by phpBB © 2001, 2002 phpBB Group

Copyright © MQSeries.net. All rights reserved.