Author |
Message
|
thimerion |
Posted: Wed Dec 17, 2008 12:26 am Post subject: Check if a channel exists with java |
|
|
Acolyte
Joined: 08 May 2007 Posts: 67 Location: Belgium
|
Hi,
I have written a customised monitoring tool to check my channels are in a valid state ... (running or inactive)
I use com.ibm.mq.pcf.* for this.
http://www.mail-archive.com/mqseries@akh-wien.ac.at/msg00260.html
I have 2 problems:
1)
Channel does not exists, and channel state is inactive is the same condition in my program, it does not return responses.
I can't find code to check the channel exists first using java.
2)
I can't find code to try and stop/start the channel if not running.
Regards,
Tim |
|
Back to top |
|
 |
mqjeff |
Posted: Wed Dec 17, 2008 3:26 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
You can ask the queue manager for a list of channels. You can then ask for the status of each individual channel, rather than asking for the status of all channels.
You can send a PCF message to start a channel. You can send a PCF message to stop a channel. |
|
Back to top |
|
 |
thimerion |
Posted: Wed Dec 17, 2008 7:33 am Post subject: |
|
|
Acolyte
Joined: 08 May 2007 Posts: 67 Location: Belgium
|
There is very few examples of PCF I can find ...
Anyone has an example program:
- That lists all channels ?
- That stops and starts a channel ?
Tim |
|
Back to top |
|
 |
mqjeff |
Posted: Wed Dec 17, 2008 7:51 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
It's really very straight forward to go back and forth between the documentation for MS0B (Java PCF Classes) and the PCF manual in the InfoCenter and do this.
It's a fundamental job skill of being a professional programmer to adapt pieces of code for other uses based on documentation. If you haven't learned that skill yet, and want to continue in a career as a programmer - start now.
Here's a tiny bit of code to get you thinking in the right direction.
Code: |
request = new PCFMessage(MQConstants.MQCMD_INQUIRE_CHANNEL_NAMES);
request.addParameter(MQConstants.MQCACH_CHANNEL_NAME, "*"); |
Note that that is from an old piece of code that used an old version of MS0B and an old version of the MQ API. I fully expect that that piece of code will fail to compile on MQ version 7. |
|
Back to top |
|
 |
thimerion |
Posted: Wed Dec 17, 2008 8:55 am Post subject: |
|
|
Acolyte
Joined: 08 May 2007 Posts: 67 Location: Belgium
|
Hi,
Got it, it's CMQCFC.MQCACH_CHANNEL_NAME, "*"
But whoow what a lesson ...
What I also have learned while working as a programmer is not to try and re-invent everything again ... Especially if you are under time pressure ...
So if someone had an example of what I needed, why not ... I'd first like to ask around if anyone already done it, if not, so be it, then I go diving in the doco ...
Thanks anyway for helping me in the right direction, it saves time ...
T |
|
Back to top |
|
 |
Vitor |
Posted: Wed Dec 17, 2008 8:59 am Post subject: |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
thimerion wrote: |
What I also have learned while working as a programmer is not to try and re-invent everything again ... Especially if you are under time pressure ...
|
Then buy a commerical monitoring solution. Quickest of all. _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
bruce2359 |
Posted: Wed Dec 17, 2008 10:34 am Post subject: |
|
|
 Poobah
Joined: 05 Jan 2008 Posts: 9469 Location: US: west coast, almost. Otherwise, enroute.
|
The write vs. buy decision is a management-political one, really.
While it might be fun to write a monitoring utility, you or your organization will be required to maintain it forever. If you are in the business of writing a monitoring utiility, that is likely an appropriate business decision.
If you are like most IT shops, IT exists to meet business requirements, like accounting, billing, inventory.
Where is the time and money best spent? Re-inventing the (monitoring utility) wheel? Or buying an existing one? _________________ I like deadlines. I like to wave as they pass by.
ב''ה
Lex Orandi, Lex Credendi, Lex Vivendi. As we Worship, So we Believe, So we Live. |
|
Back to top |
|
 |
exerk |
Posted: Wed Dec 17, 2008 11:47 pm Post subject: |
|
|
 Jedi Council
Joined: 02 Nov 2006 Posts: 6339
|
Sounds like yet another case of the management not focussing on their core business, i.e. are we a bank/insurer/<insert business type here>, or are we also a software shop? I suppose the problem is perception - off the shelf seems to be considered more expensive than in-house provision because of the high initial spend. Management don't seem to like doing spend to save... _________________ It's puzzling, I don't think I've ever seen anything quite like this before...and it's hard to soar like an eagle when you're surrounded by turkeys. |
|
Back to top |
|
 |
|