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 API Support » [Solved]List all existed local Q Managers in own Java App.

Post new topic  Reply to topic
 [Solved]List all existed local Q Managers in own Java App. « View previous topic :: View next topic » 
Author Message
cyberimp
PostPosted: Mon Aug 09, 2004 9:17 pm    Post subject: [Solved]List all existed local Q Managers in own Java App. Reply with quote

Newbie

Joined: 09 Aug 2004
Posts: 9

I want to list all local QMs in my Java App.
how to get these QMs' name and current status?
Is it possible to do it with JAVA API?

Thanks!


Last edited by cyberimp on Tue Aug 17, 2004 2:47 am; edited 2 times in total
Back to top
View user's profile Send private message
clindsey
PostPosted: Tue Aug 10, 2004 5:32 am    Post subject: Reply with quote

Knight

Joined: 12 Jul 2002
Posts: 586
Location: Dallas, Tx

There is no api for this. You can issue a system call to launch 'dspmq' with redirected ouput and then parse the redirected output from your java app.

Charlie
Back to top
View user's profile Send private message
cyberimp
PostPosted: Tue Aug 10, 2004 7:09 pm    Post subject: Reply with quote

Newbie

Joined: 09 Aug 2004
Posts: 9

thanks Charlie!

Why MQSeries API are so weak, especially JAVA API?
Maybe they should make another SupportPack.

Anyway, as my OS is windows, so I am trying to get those information from Registry on Windows.
You ideal is simple and it should can be applied in Unix.

Back to top
View user's profile Send private message
sjensen
PostPosted: Wed Aug 11, 2004 3:21 am    Post subject: Reply with quote

Centurion

Joined: 18 Dec 2003
Posts: 134
Location: London

Hi,

On Unix can you not just parse the mqs.ini file? Of course that only give the names not the running status.

Cheers
Stefan
Back to top
View user's profile Send private message
RogerLacroix
PostPosted: Wed Aug 11, 2004 2:09 pm    Post subject: Reply with quote

Jedi Knight

Joined: 15 May 2001
Posts: 3264
Location: London, ON Canada

Hi,

There is no MQ system component that your application can talk to - only the queue managers of each MQ system.

What is so hard about issuing the dspmq command from Java and parsing the results? You will get a list of ALL queue managers on the box and their current status.

Quote:
On Unix can you not just parse the mqs.ini file?

Sure you can. From a shell script, you just do:
Code:
#!/bin/ksh
#
let n=0
cat /var/mqm/mqs.ini | while read line
do
   case $line in
        Name=* )
            echo "Queue manager name = " ${line#Name=}
   esac
done

exit 0


Regards,
Roger Lacroix
Capitalware Inc.
_________________
Capitalware: Transforming tomorrow into today.
Connected to MQ!
Twitter
Back to top
View user's profile Send private message Visit poster's website
bower5932
PostPosted: Thu Aug 12, 2004 8:18 am    Post subject: Reply with quote

Jedi Knight

Joined: 27 Aug 2001
Posts: 3023
Location: Dallas, TX, USA

I'm not sure that I'd say the java api is weak. Are you looking at the base MQ java classes or the PCF classes that ship with SupportPac MS0B? If you want to do administration, you need to use MS0B.
Back to top
View user's profile Send private message Send e-mail Visit poster's website AIM Address Yahoo Messenger
Michael Dag
PostPosted: Thu Aug 12, 2004 11:37 pm    Post subject: Reply with quote

Jedi Knight

Joined: 13 Jun 2002
Posts: 2607
Location: The Netherlands (Amsterdam)

sjensen wrote:
On Unix can you not just parse the mqs.ini file? Of course that only give the names not the running status.


Look here: http://www.mqseries.net/phpBB2/viewtopic.php?t=12704
_________________
Michael



MQSystems Facebook page
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
cyberimp
PostPosted: Fri Aug 13, 2004 4:35 am    Post subject: Reply with quote

Newbie

Joined: 09 Aug 2004
Posts: 9

It seems that we can't get the local queue manager information from PCF class in MS0B pack.

On windows plat, we can use JNI method to access the registry and get the related qm info. I have tried it.

thanks everyone!
Back to top
View user's profile Send private message
vennela
PostPosted: Fri Aug 13, 2004 6:44 am    Post subject: Reply with quote

Jedi Knight

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

Quote:
Why MQSeries API are so weak, especially JAVA API?

Maybe you are weak in Java!!!!

This is as simple as
Code:

Process l_oProcess = Runtime.getRuntime().exec("dspmq");
BufferedReader stdInput = new BufferedReader(new InputStreamReader(l_oProcess.getInputStream()));


And it will work on both Windows and Unix
Back to top
View user's profile Send private message Send e-mail Visit poster's website
jefflowrey
PostPosted: Fri Aug 13, 2004 6:50 am    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

vennela wrote:
Quote:
Why MQSeries API are so weak, especially JAVA API?

Maybe you are weak in Java!!!!

This is as simple as
Code:

Process l_oProcess = Runtime.getRuntime().exec("dspmq");
BufferedReader stdInput = new BufferedReader(new InputStreamReader(l_oProcess.getInputStream()));


And it will work on both Windows and Unix


Provided, of course, that dspmq is on the PATH of the current environment...
_________________
I am *not* the model of the modern major general.
Back to top
View user's profile Send private message
cyberimp
PostPosted: Sat Aug 14, 2004 9:34 am    Post subject: Reply with quote

Newbie

Joined: 09 Aug 2004
Posts: 9

vennela wrote:
Quote:
Why MQSeries API are so weak, especially JAVA API?

Maybe you are weak in Java!!!!

This is as simple as
Code:

Process l_oProcess = Runtime.getRuntime().exec("dspmq");
BufferedReader stdInput = new BufferedReader(new InputStreamReader(l_oProcess.getInputStream()));


And it will work on both Windows and Unix



vennela, you are right, I am not very familiar with JAVA and MQ, so I hope there have all kinds api to do everything, like adding queue dynamicly and so on. Maybe I should not say that...
BTW, On windows platform, I need get all exist queue managers and their available ports.
Thanks for your help again.
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Sat Aug 14, 2004 5:20 pm    Post subject: Reply with quote

Grand High Poobah

Joined: 18 Nov 2003
Posts: 20756
Location: LI,NY

Cyberimp:
If you are on the windows platform you will need to use the windows API to access the registry. Of course that's not going to happen (security)
Why do you need the ports?
This enquiry would only work on the current platform anyway.
So you could connect in bindings mode: no need for port number.
You would need to know the channel though.

Much easier way to get what you need: Talk to your MQ administrator. He'll fill you in on what you need to know and tell you which programming books you need to read.

Quote:
vennela, you are right, I am not very familiar with JAVA and MQ, so I hope there have all kinds api to do everything, like adding queue dynamicly and so on. Maybe I should not say that...


You will have no problem about creating a dynamic queue as a temporary queue. For the permanent kind you should have the MQ Admin create them.

Enjoy
Back to top
View user's profile Send private message Send e-mail
RogerLacroix
PostPosted: Sun Aug 15, 2004 8:33 am    Post subject: Reply with quote

Jedi Knight

Joined: 15 May 2001
Posts: 3264
Location: London, ON Canada

Just to clarify this comment:
Quote:
So you could connect in bindings mode: no need for port number.
You would need to know the channel though.


Binding Mode:
The ONLY thing you need is the queue manager name. Although, you can set the other fields to null.
Code:
MQEnvironment.hostname = null;
MQEnvironment.channel  = null;
MQEnvironment.port     = 0;
//
MQQueueManager _qMgr = new MQQueueManager("MyQMgrName");


Client Mode:
You need 4 pieces of information:
Code:
MQEnvironment.hostname = "10.10.10.10";
MQEnvironment.channel  = "MY_SVRCONN_CHL";
MQEnvironment.port     = 1414;
//
MQQueueManager _qMgr = new MQQueueManager("MyQMgrName");

Regards,
Roger Lacroix
_________________
Capitalware: Transforming tomorrow into today.
Connected to MQ!
Twitter
Back to top
View user's profile Send private message Visit poster's website
cyberimp
PostPosted: Sun Aug 15, 2004 10:37 am    Post subject: Reply with quote

Newbie

Joined: 09 Aug 2004
Posts: 9

fjb_saper wrote:
Cyberimp:
If you are on the windows platform you will need to use the windows API to access the registry. Of course that's not going to happen (security)
Why do you need the ports?
This enquiry would only work on the current platform anyway.
So you could connect in bindings mode: no need for port number.
You would need to know the channel though.

Yes and I should take more time on the MQ books.

fjb_saper wrote:
Much easier way to get what you need: Talk to your MQ administrator. He'll fill you in on what you need to know and tell you which programming books you need to read.
Enjoy

well, maybe after I finish all the MQ ebooks, our team will have the MQ admin.

Thanks for your and RogerLacroix's help.
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 API Support » [Solved]List all existed local Q Managers in own Java App.
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.