MDB reconnection

The asynchronous nature of message-driven beans means that the JMS provider must be permanently connected to the messaging system in order to know when a message is available for delivery. I received a question last week as to what WebSphere Application Server’s behaviour is when that connection is broken.

If you are using the default messaging provider in WebSphere Application Server Version 6 then there are two options. If the resource adapter representing the MDB is connecting to a messaging engine running in the same process then the only way to lose connectivity is if the messaging engine has been stopped. In that case, the resource adapter is notified when the messaging engine restarts and can reconnect immediately. If the MDB loses connectivity to a remote messaging engine then the resource adapter will attempt to reconnect every 30 seconds until it is successful.

If you are using listener ports (for example with WebSphere MQ) then the behaviour is different. The retry behaviour is governed by two custom properties, MAX.RECOVERY.RETRIES and RECOVERY.RETRY.INTERVAL, that are documented in the InfoCenter. The default values for these are 5 and 60 seconds respectively. After the maximum number of retries has been exceeded the listener port is stopped and has to be restarted via the administrative console or JMX.

Comments are closed.