4 Replies Latest reply on Aug 21, 2009 10:08 AM by Mayank Mittal

    Missing messages after the failover of Jboss Node

    Mayank Mittal Novice

      Configuration:
      Jboss 4.2.3 GA
      Jboss Messaging 1.4.2-SP1

      ClusteredConnectionFactory is loadbalanced and failover enabled
      Clustered and FailoverOnNodeLeave is set to true in PostOffice Service

      Setup:
      2 Nodes
      1 Sender ( invoking calls to session bean, resulting in JMS events to clustered topic)
      1 Receiver (Listing to the clustered topic, with ClusteredConnectionFactory)

      Scenario:

      We are running a sender, which is placing the call to the session bean on every 500ms. This call results in three events every time.
      We are also running the receiver which is continuously listing to those events from the topic.

      Problem:
      When i terminate one of my JBoss node in cluster, client pauses for few seconds and then resumes events from other node. But, some events are missed during this process.

      plz. suggest



        • 1. Re: Missing messages after the failover of Jboss Node
          Yong Hao Gao Master

          Can you post your receiving code here?
          Thanks.

          • 2. Re: Missing messages after the failover of Jboss Node
            Mayank Mittal Novice

            plz. find below my receiver code


             private void createJMSClient ()
             {
             final Properties props = new Properties();
             props.put(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory");
             props.put(Context.URL_PKG_PREFIXES, "org.jboss.naming:org.jnp.interfaces");
             props.put(Context.PROVIDER_URL, "NOICLT13274:1100,NOICLT22560:1100,NOICLT13407:1100");
             props.put("jnp.timeout", "1000");
             props.put("jnp.sotimeout", "1000");
             props.put("jnp.disablediscovery", "true");
             props.put("jnp.partitionName", "NOICLT22560_PARTITION");
            
             try
             {
             final Context context = new InitialContext(props);
             ConnectionFactory mTopicConnectionFactory = (ConnectionFactory) context.lookup("ClusteredConnectionFactory");
             System.out.println(mTopicConnectionFactory);
             Topic mTopic = (Topic) context.lookup("topic/CMSPublic");
            
             Connection mTopicConnection = mTopicConnectionFactory.createConnection();
             Session mTopicSession = mTopicConnection.createSession(false, Session.AUTO_ACKNOWLEDGE);
            
             // Create subscriber
             MessageConsumer mSubscriber = mTopicSession.createConsumer(mTopic);
             mSubscriber.setMessageListener(this);
             mTopicConnection.setExceptionListener(this);
            
             mTopicConnection.start();
             isConnected = true;
             }
             catch (final CommunicationException anException)
             {
             // anException.printStackTrace();
             System.err.println("Server is not avaliable!!! \n Trying to reconnect the server!! " + anException.getMessage());
             }
             catch (final NamingException anException)
             {
             // anException.printStackTrace();
             System.err.println("Server is not avaliable!!! \n Trying to reconnect the server!! " + anException.getMessage());
             }
            
             catch (final JMSException anException)
             {
             // anException.printStackTrace();
             System.err.println("Server is not avaliable!!! \n Trying to reconnect the server!! " + anException.getMessage());
             }
             catch (Exception finalException)
             {
             // finalException.printStackTrace();
             System.err.println("Exception while starting JMS event listener. You may not be able to receive event, please restart your application");
             }
            
             }
            


            • 3. Re: Missing messages after the failover of Jboss Node
              Yong Hao Gao Master

              I think you should use durable subscriber to make sure the message won't get lost. Can you try?

              Thanks
              Howard

              • 4. Re: Missing messages after the failover of Jboss Node
                Mayank Mittal Novice

                Durable subscription didn't suites our requirement as, durable subscription supports only one active subscriber at a rime.
                But, in our real scenario, we are targeting more than 1000 clients.