0 Replies Latest reply on Jul 30, 2010 7:59 AM by vijayraw

    Message Delay (upto 9 hours) in JBoss Messaging 1.4.0 SP3 in JBoss cluster environment

    vijayraw

      We are using JBoss cluster with two nodes and JBoss Messaging 1.4.0 SP3 as our JMS provider. We are facing message delay issue in our production environment. Logs indicates that message has been put in the queue but on the consumer side they are not consumed. They delays are quite long (upto 9-10 hours) or on restart it get consumed. We are using spring (DefaultMessageListenerContainer) on the consumer side. Each queue has only one consumer attached
      Our Message Sending Code looks like this :
      -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
      public void writeToQueue(Queue queue, JmsMessage message) throws JMSException {
              LOG.info("Entering with queue " + queue);
              Connection jmsConnection = null;
              try {
                  jmsConnection = connectionFactory.createConnection();
                  jmsConnection.start();

       

                  // Create the session
                  Session jmsSession = jmsConnection.createSession(message.isTransacted(),
                          Session.AUTO_ACKNOWLEDGE);

       

                  // Create the JMS message producer which will post messages to the
                  // destination;
                  MessageProducer messageProducer = jmsSession.createProducer(queue);
                  if (message.isPersistent()) {
                      messageProducer.setDeliveryMode(DeliveryMode.PERSISTENT);
                  } else {
                      messageProducer.setDeliveryMode(DeliveryMode.NON_PERSISTENT);
                  }

       

                  MapMessage mapMessage = jmsSession.createMapMessage();

       

                  for (Map.Entry<String, String> entry : message.getMessage().entrySet()) {
                      mapMessage.setString(entry.getKey(), entry.getValue());
                  }

       

                  messageProducer.send(mapMessage);

       

                  if (message.isTransacted()) {
                      jmsSession.commit();
                  }
              } catch (JMSException jex) {
                  LOG.error(jex.getMessage(), jex);
                  throw jex;
              } finally {
                  if (jmsConnection != null) {
                      try {
                          jmsConnection.close();
                      } catch (JMSException ignore) {
                          LOG.error(ignore.getMessage(), ignore);
                      }
                  }
              }
              LOG.info("Published a message to queue " + queue);
          }
      ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
      Attached are the Configuration Files for JBoss Messaging
      Unfortunately I could not replicate this problem in our QA or local environment.
      If anybody has faced this problem, and have workaround for this, Pls let me know.