1 Reply Latest reply on Apr 19, 2010 8:56 AM by steeven lee

    Consumer doesn't failover outside JBossAS 5.1 container

    steeven lee Newbie

      Hi all,


      I'm testing JBoss 5.1 messaging with "all" configuration.


      the MDB can auto recovery after one node shutdown, but the JMS message consumer outside that use JMS API desn't receive and message when one node shutdown.


      Here is my test code:

      while (true) {
         try {

      TopicConnection topicConn = tcf.createTopicConnection();
      TopicSession topicSession = topicConn.createTopicSession(false,
      MessageConsumer consumer = topicSession.createConsumer(topic);
      while (true) {
         TextMessage msg = (TextMessage) consumer.receive();
         if (msg != null) {
           System.out.println("receive0 conn: " + topicConn);
           System.out.println("receive0 msg: " + msg.getText());

        } catch (Exception e) {
           System.out.println("listen error: " + e);

      Another thread send message every 5 second. The console works right when 2 server nodes both working. After 1 node shut down, the thread hang and never response even if the node restarted.


      It's interesting that the "consumer.receive(timeout)" don't work too, but this method will throw javax.jms.IllegalStateException, that gives a change to reestablish the connection and listen again.









      I read the JBoss Cluster document, the Failover should be recovered under table, am I leading the wrong way?


      BTW, in wiki there is a demo that send JMS, every time a Connection is created, is it a MUST? I tested it 7 sec to send 100 msg, 1.5 sec if the connection is cached.





        • 1. Re: Consumer doesn't failover outside JBossAS 5.1 container
          steeven lee Newbie

          I found this line wait a long time and return null ClientConnectionDelegate if the failedNodeIDToServer!=-1


          CreateConnectionResult res = delegate.
          createConnectionDelegate(username, password, failedNodeIDToServer);


          As a workaround, -1 worked happly with me, but I not sure what's the side effect.


          Is there a easy document on how-to replace 1.4.3 to most recently 1.4.5/6 version?

          Why don't JBoss release a new patch version over half a year?  I'm really confused that there is so many bugs in AS 5.1 GA version.