|  | 
 
  
    | RSS Feed - WebSphere MQ Support | RSS Feed - Message Broker Support |  
 
  
	|    |  |  
  
	| MQ JMS doesnt initiate connection to MQ server automatically | « View previous topic :: View next topic » |  
  	| 
		
		
		  | Author | Message |  
		  | glen254 | 
			  
				|  Posted: Mon Jan 07, 2008 2:10 am    Post subject: MQ JMS doesnt initiate connection to MQ server automatically |   |  |  
		  | Newbie
 
 
 Joined: 08 Jan 2006Posts: 4
 
 
 | 
			  
				| We have a MQ JMS implementation that makes use of client connection calls to a remote MQ server to pick up messages and process them via MDBs 
 The MQ JMS client and MQ Server are on 2 different servers.
 The MQ version is 6.0
 The operating system is Windows XP
 
 
 The MQ JMS implementation is done as follows
 
 1. We create/lookup the JMSConnectionFactory(In this case, we are creating MQQueueConnectionFactory and setting the properties such as hostname, port etc).
 2. From the ConnectionFactory, we call createConnection which gives us the JMS Providers connection.
 3. We call  start method on the Connection.
 4. We create a ServerSessionPool which actually holds the threads and Message Listener.
 5. We create a connectionConsumer on the connection using connection.createConnectionConsumer() with ServerSessionPool as one of the params.
 6. Now, the connectionConsumer is the one that is actually responsible for receiving the messages from MQServer and pushing them to MDB. The following is the flow used in most of the JMS Server implementations:
 
 When ConnectionConsumer sees that there are messages on the Queue, it fetches them and tries to get a ServerSession from the ServerSessionPool. This object will have a session created on the Connection and the ConnectionConsumer will call start on the ServerSession. This inturn registers a MDB as the message listener on the Session. The session will inturn call the onMessage of the MDB.
 
 
 This configuration works fine when there is network connectivity between the client and MQ server.
 
 Now when there is a network failure (test was carried out by manually disconnecting the MQ server by detaching the n/w cable), the client goes into a retry mode. The retry count is calculated from the 'Hearbeat Interval' on the SYSTEM.DEF.SVRCONN channel and is arrived as below
 
 Retry interval = Heartbeat Interval * 1000 + 60000
 
 which means - that if the Heartbeat Interval is 300 seconds, then the retry timeout will be 360 seconds
 
 When a n/w failure scenario is simulated, the logs clearly show the retries tacking place and after 6 minutes (360 seconds) a callback is given to the ExceptionListener - onException() method.
 
 This working is fine if the n/w was down during this 6 minute interval. But even when the n/w cable is plugged back into the MQ server within 15-20 seconds, the MQ JMS implementation does not automatically reinitiate the connection itself. It is noticed that the callback to the ExceptionListener is done after 6 minutes
 
 
 In this case -
 
 1. Does MQ JMS reinitiate the connection automatically (if possible) without  having to notify the ExceptionListener??
 
 2. Would the ExceptionListener always be notified after the timeout interval even after the network is back up??
 |  |  
		  | Back to top |  |  
		  |  |  
		  | fjb_saper | 
			  
				|  Posted: Mon Jan 07, 2008 4:30 am    Post subject: |   |  |  
		  |  Grand High Poobah
 
 
 Joined: 18 Nov 2003Posts: 20767
 Location: LI,NY
 
 | 
			  
				| From what you told us you do not simulate a network interruption but a network brake down: the client end has been notified that the connection is not working and cut it. So even if the physical connection is restored the logical connection remains broken. 
 To simulate a true network interruption you would have to interrupt the connection between 2 routers... for probably less than the heartbeat interval.
 
 Enjoy
  _________________
 MQ & Broker admin
 |  |  
		  | Back to top |  |  
		  |  |  
		  | PeterPotkay | 
			  
				|  Posted: Mon Jan 07, 2008 8:59 am    Post subject: Re: MQ JMS doesnt initiate connection to MQ server automatic |   |  |  
		  |  Poobah
 
 
 Joined: 15 May 2001Posts: 7723
 
 
 | 
			  
				| 
   
	| glen254 wrote: |  
	| Now when there is a network failure (test was carried out by manually disconnecting the MQ server by detaching the n/w cable), the client goes into a retry mode. The retry count is calculated from the 'Hearbeat Interval' on the SYSTEM.DEF.SVRCONN channel and is arrived as below 
 Retry interval = Heartbeat Interval * 1000 + 60000
 
 which means - that if the Heartbeat Interval is 300 seconds, then the retry timeout will be 360 seconds
 
 |  
 Where did you get this formula? I'm far from an MDB expert, but I doubt they get their retry logic from an MQ channel's Heartbeat setting. More likely the QCF's Polling Interval attribute, no?
 _________________
 Peter Potkay
 Keep Calm and MQ On
 |  |  
		  | Back to top |  |  
		  |  |  
		  | glen254 | 
			  
				|  Posted: Thu Jan 10, 2008 9:16 pm    Post subject: |   |  |  
		  | Newbie
 
 
 Joined: 08 Jan 2006Posts: 4
 
 
 | 
			  
				| This formula is in the base implementation of the MQ JMS class and yes, it is the connection factory's polling interval. 
 What is found is that (through trace logs) - on a network break, the MQ JMS implementation is itself trying to initiate a connection to the remote MQ server for this polling interval (which is derived from the channel heartbeat interval) but the connection doesnt happen.
 
 Also as per JMS provider specifications, it is stated that a client JMS provider implementation should try and initiate a connection to the messaging server itself. Only if this is not possible, would the ExceptionListener - onException() get a callback - in this case happens after 6 minutes
 
 If the MQ JMS implementation is not going to reinitate a connection, why does it go into a retry for 6 minutes. Wouldnt it be better to do the callback earlier so that a new connection can be initiated from the client.
 |  |  
		  | Back to top |  |  
		  |  |  
		  | JLRowe | 
			  
				|  Posted: Fri Jan 11, 2008 2:35 am    Post subject: |   |  |  
		  |  Yatiri
 
 
 Joined: 25 May 2002Posts: 664
 Location: South East London
 
 | 
			  
				| Turn on AdoptNewMCA on your queue manager. |  |  
		  | Back to top |  |  
		  |  |  
		  | PeterPotkay | 
			  
				|  Posted: Fri Jan 11, 2008 9:23 am    Post subject: |   |  |  
		  |  Poobah
 
 
 Joined: 15 May 2001Posts: 7723
 
 
 | 
			  
				| I don't think AdoptNewMCA applies to SVRCONN channels. Isn't it only for QM to QM channels? _________________
 Peter Potkay
 Keep Calm and MQ On
 |  |  
		  | Back to top |  |  
		  |  |  
		  |  |  |  
  
	|    |  | Page 1 of 1 |  
 
 
  
  	| 
		
		  | 
 
 | 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
 
 |  |  |  |