Author |
Message
|
cyberimp |
Posted: Mon Aug 09, 2004 9:17 pm Post subject: [Solved]List all existed local Q Managers in own Java App. |
|
|
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 |
|
 |
clindsey |
Posted: Tue Aug 10, 2004 5:32 am Post subject: |
|
|
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 |
|
 |
cyberimp |
Posted: Tue Aug 10, 2004 7:09 pm Post subject: |
|
|
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 |
|
 |
sjensen |
Posted: Wed Aug 11, 2004 3:21 am Post subject: |
|
|
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 |
|
 |
RogerLacroix |
Posted: Wed Aug 11, 2004 2:09 pm Post subject: |
|
|
 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 |
|
 |
bower5932 |
Posted: Thu Aug 12, 2004 8:18 am Post subject: |
|
|
 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 |
|
 |
Michael Dag |
Posted: Thu Aug 12, 2004 11:37 pm Post subject: |
|
|
 Jedi Knight
Joined: 13 Jun 2002 Posts: 2607 Location: The Netherlands (Amsterdam)
|
|
Back to top |
|
 |
cyberimp |
Posted: Fri Aug 13, 2004 4:35 am Post subject: |
|
|
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 |
|
 |
vennela |
Posted: Fri Aug 13, 2004 6:44 am Post subject: |
|
|
 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 |
|
 |
jefflowrey |
Posted: Fri Aug 13, 2004 6:50 am Post subject: |
|
|
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 |
|
 |
cyberimp |
Posted: Sat Aug 14, 2004 9:34 am Post subject: |
|
|
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 |
|
 |
fjb_saper |
Posted: Sat Aug 14, 2004 5:20 pm Post subject: |
|
|
 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 |
|
 |
RogerLacroix |
Posted: Sun Aug 15, 2004 8:33 am Post subject: |
|
|
 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 |
|
 |
cyberimp |
Posted: Sun Aug 15, 2004 10:37 am Post subject: |
|
|
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 |
|
 |
|