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 » Finding out default queue manager name

Post new topic  Reply to topic
 Finding out default queue manager name « View previous topic :: View next topic » 
Author Message
leot
PostPosted: Mon Apr 22, 2002 2:32 pm    Post subject: Reply with quote

Novice

Joined: 21 Apr 2002
Posts: 24
Location: NYC

I am using MQSeries Java API (non-JMS).

If I set queue manager name to "" or null when connecting, I get a connection to whatever is set as default manager.

Once I connected: is there a way to find what manager I am connected to?

Thanks,
Leo
Back to top
View user's profile Send private message Send e-mail
StefanSievert
PostPosted: Mon Apr 22, 2002 2:58 pm    Post subject: Reply with quote

Partisan

Joined: 28 Oct 2001
Posts: 333
Location: San Francisco

Yes, you can MQOPEN the queue manager object MQOT_QMGR with the MQOO_INQUIRE options set and inquire the name attribute. The application programming guide (or the programmable systems management guide) should contain the details.
Hope that helps,
Stefan

_________________
Stefan Sievert
IBM Certified * WebSphere MQ
Back to top
View user's profile Send private message
leot
PostPosted: Mon Apr 22, 2002 3:57 pm    Post subject: Reply with quote

Novice

Joined: 21 Apr 2002
Posts: 24
Location: NYC

I looked up MQOO_INQUIRE, and it appears that this is a value for the queue opening options, not the manager. In fact, I cannot see any options for connecting to a queue manager, other than an int that specifies whether I want fast or not. And what API calls do I use to inquire about queue manager name? I cannot find any methods in MQQueueManager that return its name either.

Thanks,
Leo
Back to top
View user's profile Send private message Send e-mail
leot
PostPosted: Mon Apr 22, 2002 3:58 pm    Post subject: Reply with quote

Novice

Joined: 21 Apr 2002
Posts: 24
Location: NYC

I meant "fast bindings", not just "fast".
Sorry.
Leo
Back to top
View user's profile Send private message Send e-mail
StefanSievert
PostPosted: Tue Apr 23, 2002 10:24 am    Post subject: Reply with quote

Partisan

Joined: 28 Oct 2001
Posts: 333
Location: San Francisco

Quote:

On 2002-04-22 16:57, leot wrote:
I looked up MQOO_INQUIRE, and it appears that this is a value for the queue opening options, not the manager. In fact, I cannot see any options for connecting to a queue manager, other than an int that specifies whether I want fast or not. And what API calls do I use to inquire about queue manager name? I cannot find any methods in MQQueueManager that return its name either.

Thanks,
Leo

Leo,
this is a quote from the MQOPEN call description in the Application Programming reference:
<quote>
MQOO_INQUIRE
Open object to inquire attributes.
The queue, namelist, process definition, or queue manager is opened for use with subsequent MQINQ calls.

This option is valid for all types of object other than distribution lists.
</quote>
So, you need to specify MQOT_Q_MGR as the objectType in the object descriptor on the MQOPEN and then call MQINQ to inquire for the attribute 'QMgrName'. Please see the description for the MQINQ call in the APR manual for details.
If you are familiar with C, here's an extract of the IBM provided sample program amqscnxc.c which does exactly what you are looking for:
Quote:

/******************************************************************/
/* */
/* Open the queue manager object to find out its name */
/* */
/******************************************************************/
od.ObjectType = MQOT_Q_MGR; /* open the queue manager object*/
MQOPEN(Hcon, /* connection handle */
&od, /* object descriptor for queue */
MQOO_INQUIRE + /* open it for inquire */
MQOO_FAIL_IF_QUIESCING, /* but not if MQM stopping */
&Hobj, /* object handle */
&OpenCode, /* MQOPEN completion code */
&Reason); /* reason code */

/* report reason, if any */
if (Reason != MQRC_NONE)
{
printf("MQOPEN ended with reason code %ldn", Reason);
}

if (OpenCode == MQCC_FAILED)
{
printf("Unable to open queue manager for inquiren");
}

/******************************************************************/
/* */
/* Inquire the name of the queue manager */
/* */
/******************************************************************/
if (OpenCode != MQCC_FAILED)
{
Selector = MQCA_Q_MGR_NAME;

MQINQ(Hcon, /* connection handle */
Hobj, /* object handle for q manager */
1, /* inquire only one selector */
&Selector, /* the selector to inquire */
0, /* no integer attributes needed */
NULL, /* so no buffer supplied */
MQ_Q_MGR_NAME_LENGTH, /* inquiring a q manager name */
QMName, /* the buffer for the name */
&CompCode, /* MQINQ completion code */
&Reason); /* reason code */

if (Reason == MQRC_NONE)
{
printf("Connection established to queue manager %-48.48sn",
QMName);
}
else
{
/* report reason, if any */
printf("MQINQ ended with reason code %ldn", Reason);
}
}

The same logic should be available for Java code, though I couldn't find any samples. Maybe somebody else has more info.
Hope that gets you started,
Stefan

_________________
Stefan Sievert
IBM Certified * MQSeries

[ This Message was edited by: StefanSievert on 2002-04-23 11:26 ]
Back to top
View user's profile Send private message
StefanSievert
PostPosted: Tue Apr 23, 2002 10:35 am    Post subject: Reply with quote

Partisan

Joined: 28 Oct 2001
Posts: 333
Location: San Francisco

Leo,
I just did a little more reading in the Using Java manual. You should be able to retrieve the name of the queue manager by doing something like this:

MQManagedObject mqmo = (MQManagedObject)yourQueueManagerObject;

and then invoking mqmo.inquire using the arguments required to retrieve the queue manager name. The algorithm seems to be the same.
Stefan

_________________
Stefan Sievert
IBM Certified * WebSphere MQ
Back to top
View user's profile Send private message
leot
PostPosted: Wed Apr 24, 2002 4:12 am    Post subject: Reply with quote

Novice

Joined: 21 Apr 2002
Posts: 24
Location: NYC

Stefan,
Thanks for your help!
I was eventually pointed in the same direction as you suggested: using inquire() of the MQManagedObject, of which MQQueueManager is descendant.

Do you know if it is in anybody's plans at IBM to keep making MQSeries Java API more like Java, and less like C? (the inquire() method is a perfect example - a method whose behavior is fully determined by the arguments passed, and returns have to be parsed and interrogated according to some not-so-obvious rules)

Thanks again,
Leo
Back to top
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » IBM MQ Java / JMS » Finding out default queue manager name
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.