2 Replies Latest reply on Dec 3, 2008 4:21 AM by cbolanos

    Problem in topic consumers when lost connections

    cbolanos

      Hello.

      I have installed JBoss Messaging 1.4.0 SP3 in a Jboss Server 4.2.2.GA, persisted in a MySQL database, and no clustered.
      I have deployed one topic and one queue, and a MDB in a the Jboss Server, and I have multiple standalone clients. The clients send messages to the queue, the MDB consumes this messages and publish them in the topic, and finally the standalone clients consumes the messages from the topic.

      My problem is that when the stand alone client reconects after lossing connection with the Jboss server, (something that is very probably, because they connect through internet) it can sends messages to the queue but it cannot consume messages from the topic.

      I have read before in other responses of this forum, this problem is fixed using newer versions of jboss remoting, but I have the same problem using jboss remoting 2.2.2 SP4, as recomended, and with version 2.5.0.GA

      Excuse my bad english, and any help will be welcome

      Regards,

        • 1. Re: Problem in topic consumers when lost connections
          clebert.suconic

           

          My problem is that when the stand alone client reconects after lossing connection with the Jboss server, (something that is very probably, because they connect through internet) it can sends messages to the queue but it cannot consume messages from the topic.


          It is not clear to me how you are reconnecting your clients. Can you elaborate on that please?

          • 2. Re: Problem in topic consumers when lost connections
            cbolanos

            Thank you very much for replaying...

            Well, really I'm not reconecting in my code. When phisical connection goes down, then I can see warn messages from LeasePinger, and when the client recovers its connection warn messages don't appear. In this situation, the client can send again messages to the queue, but cannot receive messages from the topic.

            This is a extract of my code, from the client's GUI you call the send information method, and the AVListener's onMessage method only prints the information received on that GUI.

            ...

            public void run()
            {
            try
            {
            initConnections();
            startTopicListener();
            status = RUNNING;
            while(status == RUNNING)
            {
            try
            {
            synchronized (this)
            {
            this.wait(10000);
            }
            }
            catch(InterruptedException ie)
            {
            ie.printStackTrace();
            }
            }//while
            }//try
            catch(Exception e)
            {
            e.printStackTrace();
            }//catch
            finally
            {
            finishTopicListener();
            finishConnections();
            }

            }

            public void sendInformation(Object info) throws Exception
            {
            Queue queue = (Queue)ic.lookup(destinationName);
            MessageProducer sender = qsession.createProducer(queue);
            TextMessage message = qsession.createTextMessage(info.toString());
            message.setStringProperty(propClientId, clientId);
            sender.send(message);
            }

            public void initConnections() throws Exception
            {
            ic = new InitialContext();
            ConnectionFactory cf = null;
            cf = (ConnectionFactory)ic.lookup("/ConnectionFactory");
            connection = cf.createConnection(jmsUser, jmsPwd);
            //Obligatorio indicar clientid para poder crear una durable suscription
            connection.setClientID(clientId);
            session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
            qsession = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);

            }

            public void startTopicListener() throws Exception
            {
            Topic topic = (Topic)ic.lookup(topicName);
            subscriber = session.createDurableSubscriber(topic, subscriptionName);
            avListener = new AVTopicListener();
            subscriber.setMessageListener(avListener);
            connection.start();
            }


            public void finishConnections() throws Exception
            {
            if (connection != null)
            {
            connection.close();
            }
            if (ic != null)
            {
            ic.close();
            }
            }

            public void finishTopicListener() throws Exception
            {
            subscriber.close();
            session.close();
            qsession.close();
            }

            ...