1 Reply Latest reply on May 18, 2008 1:56 AM by Yong Zhang

    Intermittent issue where messages stuck on clustered queue

    Yong Zhang Newbie

      Hi,

      jboss-4.2.2.GA / jboss-messaging-1.4.0.SP3 / jboss-remoting-2.2.2.SP4

      I have a jboss cluser with 3 nodes:
      1. Each nodes has a clustered queue.
      2. Each node sends messages to its local partial queue of this clustered queue using ConnectionFactory.
      3. I am trying to use one listener that listens on this clustered queue.

      My first attempt is to use one connection to create a receiver on the clustered queue, but it fails to receive messages on other nodes, and some messages stuck on their local partial queue. Then here is my second implementations of this listener:
      1) Create 3 connections/sessions using ClusteredConnectionFactory, so it supposes to be round-robin and creates one connection to each node.
      2) Create one receiver with msg selector on each session using:

      session.createReceiver(_replyQueue, selector.toString());

      Then add these 3 receivers into a list.
      3) When the listener needs to retrieve a message, it goes through this receiver list:
      for(QueueReceiver receiver : replyQueueReceivers) {
      Message msg = receiver.receiveNoWait();
      if(msg != null && msg instanceof ObjectMessage) {
      ObjectMessage objMsg = (ObjectMessage) msg;
      return objMsg;
      }
      }

      This approach works in most cases. However, sometime I found the listener fails to retrieve messages that are in the queue. From jmx console, I can see there is one message in the queue, and there is one consumer(which is the listener) on the queue, but it appears the message stuck in the queue and listener fails to retrieve it.

      Any ideas? Thanks.