2 Replies Latest reply on Jan 8, 2018 10:22 AM by maintaps

    JMS hornetQ client connection timeout / connectivity issues detection

    maintaps

      Hello,

       

      Can someone please point me the right direction in how to set the connection timeout for a JMS client listening to VSD events ?

       

      I am using JMS with HornetQ to establish a durable subscription to a JMS server which is not under my control.

       

      The JMS client code is here :

      https://github.com/nuagenetworks/jmsclient/tree/r4.0

      https://github.com/nuagenetworks/jmsclient/blob/r4.0/src/main/java/com/alu/cna/cloudmgmt/util/jms/AbstractJMSClient.java

       

      The code is running on CentOS v7.

       

      The server is running hornetq v 2.3.25 and the client 2.3.CR1

       

      The connection is made using JNDI :

       

              Properties env = new Properties();

              env.put(Context.INITIAL_CONTEXT_FACTORY, INITIAL_CONTEXT_FACTORY);

              env.put(InitialContext.URL_PKG_PREFIXES, "org.jboss.naming:org.jnp.interfaces");

              env.put(Context.PROVIDER_URL, providerUrl);

       

              jndiCtx = new InitialContext(env);

              ConnectionFactory tcf = getConnectionFactory(jndiCtx);

       

      I've tried various timeout attributes but unfortunately none of them made any difference :

       

              env.put("jboss.naming.client.connect.timeout", "10000");

              env.put("jboss.naming.client.client-failure-check-period","10000");

              env.put("remote.connection.default.connect.timeout", "10000");

              env.put("jnp.timeout", "30000");

              env.put("jnp.sotimeout", "60000");

       

      Everything works as expected when the network connection to the server is good.

      The issue I am experiencing is that once the JMS client established a durable subscription to the server, in a situation where the network connection between the client and the server gets disconnected, the client doesn't detect the disconnection ( sometimes it takes 5, 10 or longer, probably towards the 2 hours TCP socket timeout ) .

       

      Even when the connection exception occurs, the client hangs again for several minutes when trying to close the session and the connection.

       

      In result, the JMS client cannot detect connectivity issues fast enough and occasionally it doesn't detect the disconnection at all.

       

      Does anyone else experienced this issue with JMS client not being able to detect and recover from connectivity issues ?

       

      Please excuse my lack of knowledge in this field, any help would be very appreciated.

       

      Thank you very much.