Enabling transparent Reconnect in SwiftMQ Universal Router

Introduction

Note: Transparent recinnect is enabled by default.

A JMS client usually works as follows:

  • It retrieves a connection factory and destinations (queues/topic) from JNDI.
  • It uses the connection factory to create JMS connection(s).
  • It creates sessions, consumers, producers, browsers to receive, send, browse messages.

Therefore a JMS client may have 2 different kind of connections to a SwiftMQ Universal Router: JNDI and JMS. SwiftMQ provides transparent reconnect for both of them and ensures that any JMS client reconnects transparently without the need to write custom reconnect code.

JNDI

Whether a JNDI context should transparently reconnect in case a of a connection lost is specified in the SMQP-URL with attributes "reconnect", "retrydelay", "maxretries".

      smqp://jms1:4001/timeout=10000;reconnect=true;retrydelay=1000;maxretries=50

The above URL enables reconnect with attempts every second and gives up after 50 times without success. A detailed description can be found in the JNDI Swiftlet documentation, section "JNDI Provider URL".

JMS

There is a whole section that explains transparent JMS reconnect.