0 Replies Latest reply on Apr 15, 2010 3:49 PM by NIranjan Nanda

    JMS Message is not consumed by MDB

    NIranjan Nanda Apprentice



      I have an MDB (EJB3) which is listening to the queue "MyQueue"  configured in HornetQ. If I run the JBoss instance on my local machine  and deploy the ADR, it is able to pick the messages, but on the  configuration I explained in my previous discussion (HornetQ inside  JBoss running on remote host), it is not picking up the messages. Could  you please help me in this regard?


      The MDB:


      @MessageDriven  (
        name = "LoggerMDB",
        description = "Puts the data in the DB  log table from MyLoggerQueue",
        activationConfig = {
             @ActivationConfigProperty(propertyName = "destinationType",  propertyValue = "javax.jms.Queue"),
             @ActivationConfigProperty(propertyName = "destination", propertyValue =  "queue/MyLoggerQueue")
      public  class DemoLoggerMDB implements MessageListener
          /**  For publishing log data in database */
          private  DatabaseLogPublisherImpl databaseLogPublisher;
            * This is a call-back method and can be used to initialize all helper  stuffs for this MDB
          public void  initializeResources() {
              logger.debug("initializeResources :  START");
              logger.debug("initializeResources :  END");
           * This call-back method can  be used to free any resources that this MDB uses.
          public void cleanupResources() {
               logger.debug("cleanupResources : START");
               logger.debug("cleanupResources : END");
          /*  (non-Javadoc)
           * @see  javax.jms.MessageListener#onMessage(javax.jms.Message)
           public void onMessage(Message message) {
               logger.debug("onMessage : START");
              if(message  instanceof ObjectMessage) {
                  try {
                       final ObjectMessage receivedMessage = (ObjectMessage) message;
                       final Object receivedObject = receivedMessage.getObject();
                       if(receivedObject instanceof LogDTO) {
                           databaseLogPublisher.publishLog((LogDTO) receivedObject);
                  } catch(Exception e) {
                      // For any  exception, let this publishing fail.
                       logger.debug("Exception while publishing log data... ", e);
                       logger.error("Exception while publishing log data... {}",  e.getMessage());
               logger.debug("onMessage : END");




      I do not get any exception; it seems no event is happening at server end. Though JMX console I can see the messages that was sent on this queue.


      Am I doing anything wrong? Any configuration with user ID and password is needed?