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 » How can I find out of the connection to the MQ Manager is lo

Post new topic  Reply to topic
 How can I find out of the connection to the MQ Manager is lo « View previous topic :: View next topic » 
Author Message
roliv
PostPosted: Fri Oct 19, 2001 5:02 pm    Post subject: Reply with quote

Novice

Joined: 26 Aug 2001
Posts: 11

Hi,
I am using MQSeries classes for Java (not JMS) and I would like to know if there is a way to find out if the connection with the MQManager has been lost (for example, the MQ administrator shuts down the MQ Manager while my application is still running). I know that the isOPen() and the isConnected() methods exist in the MQQueueManager class but the boolean values that these methods return are only updated if from my program I explicitly disconnect from the MQManager. In other words, if the MQ Manager goes down, these two methods still return true!

By the way, if the MQ Manager goes down and then I try to do a get, a put, or some other operation, I know that I get an MQException. I know I could check the reason code of that exception and that would tell me that the MQ Manager is down. But this is exactly what I am trying to avoid.

I would like to do something like this:

if (mqManager.isConnected())
{
//do a put
}

else
//do something else


If anyone knows, please let me know. Thanks.
Back to top
View user's profile Send private message
kolban
PostPosted: Fri Oct 19, 2001 6:35 pm    Post subject: Reply with quote

Grand Master

Joined: 22 May 2001
Posts: 1072
Location: Fort Worth, TX, USA

Hmmm ... interesting question. The relationship between a program and the queue manager is almost that of client/server. This means that the queue manager receives request from the application such as put a message, get a message etc. I can't think of a single instance where the queue manager calls or invokes a service of the client. As such, there is nothing that could happen asynchronously to inform the app that the queue manager is going down (or is gone). The best I can offer is that you "tickle" the queue manager prior to your operations by performing a very cheap request such as an inquiry of queue depth. If the queue manager is alive, you'll know if not, an exception will be thrown. You are trying to bend MQ semantics though because you would obviously have a window after performing a check that the queue manager is alive and before your next request where the queue manager could be shut down.

I strongly suggest that you handle exceptions thrown by any/all MQ api calls.
Back to top
View user's profile Send private message
bduncan
PostPosted: Mon Oct 22, 2001 9:25 am    Post subject: Reply with quote

Padawan

Joined: 11 Apr 2001
Posts: 1554
Location: Silicon Valley

I agree. The best way to test for a lost connection, at least from my experience, is to check every MQ API call you make for a 2009 reason code (connection broken). If the queue manager is ever shut down or just plain dies, this is what all of your calls will return.


_________________
Brandon Duncan
IBM Certified MQSeries Specialist
MQSeries.net forum moderator
Back to top
View user's profile Send private message Visit poster's website AIM Address
middlewareonline
PostPosted: Mon Oct 22, 2001 12:30 pm    Post subject: Reply with quote

Acolyte

Joined: 09 Jul 2001
Posts: 73

In past I have implemented program where I actually create a separate thread. All that thread is doing is doing INQ calls to validate the availability of queue manager. Whenever, it finds anything abnornal it informs other threads.

Raj

_________________
---------------------------------------------
IBM & SUN (J2EE) Certified Consultants,
http://www.MiddlewareOnline.com
A "SARVAM" Online Portal
http://www.SARVAM.com
---------------------------------------------
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » IBM MQ Java / JMS » How can I find out of the connection to the MQ Manager is lo
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.