2 Replies Latest reply on Oct 3, 2005 6:26 AM by shabeeshbalan

    Jboss3.2.3 - Queue Depth being shown 0 although messages sti

    shabeeshbalan

      Hello all,

      We use Jboss3.2.3 on a Solaris 5.9 on our production environment.
      There are two servers that we use in a cluster.

      We have a JMS queue from which an MDB listens to and executes application logic. There are 0 retries configured for the MDB.
      The message posted is a text message with no properties set on it.

      Whenever an exception is thrown, the messages are sent back to DLQ.

      While investigating the current issues we have found the problems with the application logic and fixed it.

      The problem is at times we see the messages in DLQ being shown as 0. We verified it through the queue Depth attribute on the MBean. These Messages are still present in the database as we use Oracle Data base for persistence.
      We have observed that after restart of the server, the queue depth restores back to the original numbers.
      We have ascertained manually that no messages have been lost yet


      Can anybody explain why this happens?

      The Code snippets below will provide more details.
      =============================================
      To allow for resubmission of selective messages, we have provided the users with a utility to submit selective messages.

      1) We use a queue browser to display the messages. Users select the required messages, which can be in any arbitrary order in the queue and resubmit them.

      <The snippet of code used to select and display the messages is >

      String strProviderURL = "jnp://" + strIPAddress + ":1099";
      Hashtable htServerConfig = new Hashtable();
      htServerConfig.put(Context.INITIAL_CONTEXT_FACTORY,
      "org.jnp.interfaces.NamingContextFactory");
      
      htServerConfig.put(Context.PROVIDER_URL, strProviderURL);
      objContext = new InitialContext(htServerConfig);
      objQueueConnectionFactory = (QueueConnectionFactory)objContext.lookup("OIL2XAConnectionFactory");
      
      objQueueConnection = (QueueConnection)objQueueConnectionFactory.createQueueConnection();
      objQueueConnection.start();
      
      objQueueSession = objQueueConnection.createQueueSession(false, Session.CLIENT_ACKNOWLEDGE);
      
      //Creat the queue session and queues
      objDLQueue = (Queue)objContext.lookup(strDLQName);
      
      //QueueReceiver objQueueReceiver = objQueueSession.createReceiver(objDLQueue);
      
      objQueueBrowser = objQueueSession.createBrowser(objDLQueue);final Enumeration enumMessages = objQueueBrowser.getEnumeration();
      
      
      TextMessage textMessage = null;
      Message message = null;
      long lDate ;
      String strWPId = null;
      final ArrayList alMessages = new ArrayList();
      Message[] messages = null;
      
      while (enumMessages.hasMoreElements()) {
      textMessage = (TextMessage)enumMessages.nextElement();
      message = new Message();
      try {
       strWPId = textMessage.getText();

      strWPId is the string that we are intersted in


      <as I said earlier , since we donot have properties set on to the text message we use a crude way for submittng selective messages>
      browse through the Q, check if the message is the one that user has requested to resubmit, if so pass it to the main queue else place it back into the DLS.

      try {
      message = (TextMessage)objQueueReceiver.receive();
      strWIPId = message.getText();
      System.out.println("ResubmitFromDLQ :: resubmitStuckJobs :: strWIPId ="+ strWIPId);
      if(alMessages != null && alMessages.contains(strWIPId)) {
       objQueueSender.send(message);
       message.acknowledge();
      System.out.println("ResubmitFromDLQ :: resubmitStuckJobs :: SENT ...strWIPId :: "+strWIPId);
      
      } else {
      System.out.println("ResubmitFromDLQ :: resubmitStuckJobs :: Time :: "+message.getJMSTimestamp());
       message.setJMSTimestamp(message.getJMSTimestamp());
       objBackQueueSender.send(message);
       message.acknowledge();
       System.out.println("ResubmitFromDLQ :: resubmitStuckJobs :: SENT to DLQ...strWIPId :: "+strWIPId);
      }


      Any suggestions and leads will be really helpful

        • 1. Re: Jboss3.2.3 - Queue Depth being shown 0 although messages
          genman


          Probably a FAQ or something, but when a message is being processed by the client, it doesn't show up as part of the queue depth.

          • 2. Re: Jboss3.2.3 - Queue Depth being shown 0 although messages
            shabeeshbalan

            Thanks genman,

            I understand that when a receiver is consuming the messages, Jboss will show zero in the queue depth.

            When queue depth is 0, we can still see the messages in the database and when we restart the server the messages re-appear in the DLQ.

            I am not aware of how jboss maintains the messages while persisting them in the oracle database.
            Does it sync up every time a message is consumed or does it sync up only when the app server is restarted or stopped?

            What we do not have a clue on is when the queue depth is shown 0, why do we still see messages in the oracle JMS Tables. The problem is when this situation happens, users cannot resubmit any pending messages and only solution that we at present know is a server restart. We have tried redeploying the queue but that was of no help.

            Any clues or hints will be helpful.