4 Replies Latest reply on Jun 21, 2007 7:03 AM by Tim Fox

    two server cluster - consumer count 2

    Keith Pirkl Newbie

      I am using messaging 1.3 with JB 4.2 clustered on two servers
      I have a standalone client application running on both servers
      The server names are jbossclust1 and jbossclust2

      When I start the client applications the Queue ConsumerCount on jbossclust2 is 2.
      I would expect the ConsumerCount to be 1 on both machines

      Here is the relevant client code.

      String strQueue = "/queue/testDistributedQueue";

      ic = new InitialContext();

      cf = (ConnectionFactory)ic.lookup("/ClusteredConnectionFactory");

      connection = cf.createConnection();

      Queue testQueue = (Queue)ic.lookup(strQueue);

      session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);

      // task queue
      MessageConsumer consumer = session.createConsumer(testQueue);

      connection.start();

      while(true) {

      // if we get an admin shutdown message - exit
      if ( false ) {
      log(" shutdown requested");
      break;
      }

      // get a task to process
      message = (TextMessage)consumer.receive(36000);

      if ( message == null ) {
      log(" no messages available");
      continue;
      }

      log(" found a message - continuing");

      ProcessMessage(message);
      }

      Suggestions please...