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 » Java: Want to monitor or ping to check if MQ connection live

Post new topic  Reply to topic
 Java: Want to monitor or ping to check if MQ connection live « View previous topic :: View next topic » 
Author Message
girish_a
PostPosted: Tue Jan 18, 2011 8:55 pm    Post subject: Java: Want to monitor or ping to check if MQ connection live Reply with quote

Newbie

Joined: 18 Jan 2011
Posts: 2

Hi

I want to check programatically every few seconds or have a listner which is notified when the connection to MQSeries queue is lost.

I tried using isConnected() and isOpen() APIs from MQManager, but they seem to be giving data from cache which is giving status as connected though the connection is lost.

I want to monitor connection and immediately when a connection is lost, want to retry to connect again.

Is there any API which will help me implement this?
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Tue Jan 18, 2011 9:02 pm    Post subject: Re: Java: Want to monitor or ping to check if MQ connection Reply with quote

Grand High Poobah

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

girish_a wrote:
Hi

I want to check programatically every few seconds or have a listner which is notified when the connection to MQSeries queue is lost.

I tried using isConnected() and isOpen() APIs from MQManager, but they seem to be giving data from cache which is giving status as connected though the connection is lost.

I want to monitor connection and immediately when a connection is lost, want to retry to connect again.

Is there any API which will help me implement this?


Have you looked at the ExceptionListener. You put it on the connection.

Have fun
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
girish_a
PostPosted: Wed Jan 19, 2011 1:07 am    Post subject: We are not using JMS, using MQ API directly Reply with quote

Newbie

Joined: 18 Jan 2011
Posts: 2

Hi

Thanks for the quick reply.

I am not using JMS to connect to MQ. I use the MQ API, like MQQueueManager, MQQueue.

Could you suggest if I there is any way to handle such connection lost exceptions?

Thanks in Advance
Back to top
View user's profile Send private message
gbaddeley
PostPosted: Wed Jan 19, 2011 4:35 pm    Post subject: Re: Java: Want to monitor or ping to check if MQ connection Reply with quote

Jedi Knight

Joined: 25 Mar 2003
Posts: 2538
Location: Melbourne, Australia

girish_a wrote:
I want to check programatically every few seconds ..... when the connection to MQSeries queue is lost.


This is generally a bad idea in any MQ programming environment. If loss of connection is a concern for the program (eg. its a MQ Client), you should detect it on return from all calls to MQ, and handle appropriately. This may include backing out, retry or recovery of transactions.

Unexpected disconnection can happen at any time (eg. 2009 reason code), even after you have just detected a disconnection and then reconnected. So it can still occur on any open / get / put etc.
_________________
Glenn
Back to top
View user's profile Send private message
Vitor
PostPosted: Wed Jan 19, 2011 5:32 pm    Post subject: Re: Java: Want to monitor or ping to check if MQ connection Reply with quote

Grand High Poobah

Joined: 11 Nov 2005
Posts: 26093
Location: Texas, USA

girish_a wrote:
I want to monitor connection and immediately when a connection is lost, want to retry to connect again.


Why not simply react to the reason code when you get it? Just because you tested a connection a few seconds ago doesn't mean it's working when you use it a few seconds later.

Or use WMQv7's inbuild client auto-reconnect.
_________________
Honesty is the best policy.
Insanity is the best defence.
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 Java / JMS » Java: Want to monitor or ping to check if MQ connection live
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.