Author |
Message
|
WannaBeInAParker |
Posted: Tue Oct 26, 2004 6:05 am Post subject: Java Program monitoring MQSeries question |
|
|
Voyager
Joined: 09 Dec 2003 Posts: 81
|
All,
I have a java program that simply starts a thread to monitor one or more queue managers to ensure that they are active. If it is active it does something, else it does something else (what exactly is done is not important to my question).
I am doing this by way of connecting to the queue manager and then disconnecting. I am looking at using the isConnected method to better the process.
If the queue manager is active or becomes active and my process is able to connect to the queue manager at least once and then the queue manager goes down while my process is still running. I then attempt to start the queue manager (outside of my program, strmqm) again and receive an error stating that a pid is still running, this pid is my java program. Does anyone know any way around this (Fail if quiescing or some workaround)?
The intent was to monitor a queue manager to ensure it is running and not to prevent it from restarting should it go inactive.
Details: Windows 2000, MQSeries 5.3 CSD06 JDK 1.4_2
Any help is appreciated.
-WannaBe- |
|
Back to top |
|
 |
RogerLacroix |
Posted: Tue Oct 26, 2004 2:33 pm Post subject: |
|
|
 Jedi Knight
Joined: 15 May 2001 Posts: 3264 Location: London, ON Canada
|
Hi,
Yes, use Fail_if_Quiescing and if that doesn't give the results then connect and immediately disconnect.
Don't do this every second but once a minute would be ok. An exception will be thrown during the connect if the queue manager is down or unavailable, plus you won't be holding open a connection. Hence the queue manager will end gracefully.
Regards,
Roger Lacroix _________________ Capitalware: Transforming tomorrow into today.
Connected to MQ!
Twitter |
|
Back to top |
|
 |
WannaBeInAParker |
Posted: Wed Oct 27, 2004 5:17 am Post subject: |
|
|
Voyager
Joined: 09 Dec 2003 Posts: 81
|
Roger,
Thanks for the reply. Just as an FYI, I am doing a connect/disconnect in successive calls. This is why I do not think that the Fail if Quiescing is going to help. I will give it a shot. Also, this is being done every thirty seconds.
Has anyone else experienced this issue?
-Jack- |
|
Back to top |
|
 |
RogerLacroix |
Posted: Wed Oct 27, 2004 9:27 am Post subject: |
|
|
 Jedi Knight
Joined: 15 May 2001 Posts: 3264 Location: London, ON Canada
|
Hi,
At my client site, they have the base contact admin product doing monitoring but did not purchase the 'Contact Admin' part. So we can do basic MQ monitoring but not 'MQ Appl monitoring'.
So, I have written a couple of Java PCF programs that do the following:
Pgm 1: Does some rules based monitoring. i.e.
- current depth GE 25 then do action
- IPPROCS LT 3 then do action
Pgm 2: Gets the queue statistics of Application queues and writes the data to a DB.
Both programs are scheduled by cron to run every minute. i.e. connect, send pcf command & disconnect. I have not had any issues doing this and they run 7/24/365.
Hope that helps.
Regards,
Roger Lacroix _________________ Capitalware: Transforming tomorrow into today.
Connected to MQ!
Twitter |
|
Back to top |
|
 |
PeterPotkay |
Posted: Wed Oct 27, 2004 1:48 pm Post subject: |
|
|
 Poobah
Joined: 15 May 2001 Posts: 7722
|
|
Back to top |
|
 |
fjb_saper |
Posted: Wed Oct 27, 2004 2:29 pm Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
Don't connect disconnect all the time if you can avoid it. Check out the JMSExceptionListener Interface and write your own ExceptionListener.
Let us know how it went.
Thanks
F.J. |
|
Back to top |
|
 |
RogerLacroix |
Posted: Thu Oct 28, 2004 5:00 am Post subject: |
|
|
 Jedi Knight
Joined: 15 May 2001 Posts: 3264 Location: London, ON Canada
|
Hi FJ,
There isn't anything wrong with connecting & disconnecting every minute (60 seconds is a long time to a computer). Since he appears to have a problem stopping a queue manager with a long running Java task, there is nothing wrong with converting it connecting & disconnecting every minute.
Secondly, I don't think he was asking for a JMS solution rather a Java base MQ solution (plus it is really hard to do proper monitoring from JMS).
Regards,
Roger Lacroix _________________ Capitalware: Transforming tomorrow into today.
Connected to MQ!
Twitter |
|
Back to top |
|
 |
WannaBeInAParker |
Posted: Thu Oct 28, 2004 5:13 am Post subject: |
|
|
Voyager
Joined: 09 Dec 2003 Posts: 81
|
All,
Just to be clear.
I am simply monitoring a queue manager to see if it is available by connecting/disconnecting at some interval. After the first successful connect/disconnect the queue manager is brought down successfully (endmqm -i <qmgrname>). The process monitoring process is still running. When I try to bring up the queue manager (strmqm <qmgrname>), it fails saying that a process is still running (my java monitoring app) and must be brought down.
The thread Peter pointed out is helpful, explaining the difference between endmqm and endmqm -i. However my process is not consistently (I say not consistently, as I am sure that there is a possibility that it could be connected when the qmgr is brought down, however it always complaining about my process) connected to the queue manager when the queue manager is brought down.
-WannaBe- |
|
Back to top |
|
 |
|