0 Replies Latest reply on Apr 16, 2019 4:54 AM by hakim saifee

    MDB is not consuming messages from JMS queue in JBoss 7.2 clustered environment

    hakim saifee Newbie

      I have a clustered environment created with JBoss EAP 7.2 server. Following are the details :

      1. DC-Server
      2. JMS-Server 1
      3. JMS-Server 2
      4. AppDeployment Server

      I'm deploying my consumer MDB on AppDeployment Server and my JMS are configured on JMS nodes (JMS Server 1 and JMS Server 2). I'm able to push my messages into queue configured on JMS nodes, but My consumer is not reading messages from this queue. Following is the configuration for the messaging subsystem on domain controller node :

       

      <subsystem xmlns="urn:jboss:domain:messaging-activemq:4.0">
        
      <server name="default">
        
      <security enabled="false"/>
        
      <cluster user="admin" password="admin"/>
        
      <journal pool-files="10"/>
        
      <statistics enabled="true"/>
        
      <shared-store-master failover-on-server-shutdown="true"/>
        
      <security-setting name="#">
        
      <role name="guest" send="true" consume="true" create-non-durable-queue="true" delete-non-durable-queue="true"/>
        
      <role name="admin" send="true" consume="true" create-durable-queue="true" create-non-durable-queue="true"/>
        
      </security-setting>
        
      <address-setting name="#" dead-letter-address="jms.queue.DLQ" expiry-address="jms.queue.ExpiryQueue" max-size-bytes="10485760" page-size-bytes="2097152" message-counter-history-day-limit="10"/>
        
      <address-setting name="alarms" dead-letter-address="jms.queue.DLQ" expiry-address="jms.queue.ExpiryQueue"/>
        
      <address-setting name="DLQ" dead-letter-address="jms.queue.DLQ" expiry-address="jms.queue.ExpiryQueue"/>
        
      <address-setting name="ExpiryQueue" dead-letter-address="jms.queue.DLQ" expiry-address="jms.queue.ExpiryQueue"/>
        
      <address-setting name="jms.queue.alarms"/>
        
      <http-connector name="http-connector" socket-binding="http" endpoint="http-acceptor"/>
        
      <http-connector name="http-connector-throughput" socket-binding="http" endpoint="http-acceptor-throughput">
        
      <param name="batch-delay" value="50"/>
        
      </http-connector>
        
      <remote-connector name="netty" socket-binding="messaging">
        
      <param name="use-nio" value="true"/>
        
      </remote-connector>
        
      <in-vm-connector name="in-vm" server-id="0">
        
      <param name="buffer-pooling" value="false"/>
        
      </in-vm-connector>
        
      <http-acceptor name="http-acceptor" http-listener="default"/>
        
      <http-acceptor name="http-acceptor-throughput" http-listener="default">
        
      <param name="batch-delay" value="50"/>
        
      <param name="direct-deliver" value="false"/>
        
      </http-acceptor>
        
      <remote-acceptor name="netty" socket-binding="messaging">
        
      <param name="use-nio" value="true"/>
        
      </remote-acceptor>
        
      <in-vm-acceptor name="in-vm" server-id="0">
        
      <param name="buffer-pooling" value="false"/>
        
      </in-vm-acceptor>
        
      <broadcast-group name="my-broadcast-group" socket-binding="messaging-group" connectors="netty"/>
        
      <discovery-group name="my-discovery-group" socket-binding="messaging-group"/>
        
      <cluster-connection name="my-cluster" address="jms" connector-name="netty" discovery-group="my-discovery-group"/>
        
      <jms-queue name="ExpiryQueue" entries="java:jboss/exported/jms/queue/ExpiryQueue" durable="false"/>
        
      <jms-queue name="DLQ" entries="java:jboss/exported/jms/queue/DLQ" durable="true"/>
        
      <jms-queue name="testQueue1" entries="queue/test1 java:jboss/exported/jms/queue/test1"/>
        
      <jms-topic name="OutboundMessagesTopic" entries="java:jboss/exported/jms/sal/msg/topic/OutboundMessagesTopic"/>
        
      <connection-factory name="InVmConnectionFactory" entries="java:/ConnectionFactory" connectors="in-vm"/>
        
      <connection-factory name="RemoteConnectionFactory" entries="java:jboss/exported/jms/RemoteConnectionFactory" connectors="http-connector"/>
        
      <pooled-connection-factory name="activemq-ra" entries="java:/JmsXA java:jboss/DefaultJMSConnectionFactory" connectors="in-vm" transaction="xa" user="admin" password="admin" statistics-enabled="true"/>
        
      </server>
      </subsystem>

      Below is the MDB code was written to read from the queue :

       

      package org.jboss.as.quickstarts.mdb;

      import java.util.logging.Logger;
      import javax.ejb.ActivationConfigProperty;
      import javax.ejb.MessageDriven;
      import javax.jms.JMSException;
      import javax.jms.Message;
      import javax.jms.MessageListener;
      import javax.jms.TextMessage;

      @MessageDriven(name = "HelloWorldQueueMDB", activationConfig = {

      // @ActivationConfigProperty(propertyName = "destinationLookup", propertyValue = "queue/HELLOWORLDMDBQueue"),
        
      @ActivationConfigProperty(propertyName = "destination", propertyValue = "queue/test1"),
        
      @ActivationConfigProperty(propertyName = "destinationType", propertyValue = "javax.jms.Queue"),
        
      @ActivationConfigProperty(propertyName = "user", propertyValue = "admin"),
        
      @ActivationConfigProperty(propertyName = "password", propertyValue = "javax.jms.Queue"),
        
      @ActivationConfigProperty(propertyName = "acknowledgeMode", propertyValue = "Auto-acknowledge")})
      public class HelloWorldQueueMDB implements MessageListener {

        
      private static final Logger LOGGER = Logger.getLogger(HelloWorldQueueMDB.class.toString());

        
      /**
        * @see MessageListener#onMessage(Message)
        */


        
      public HelloWorldQueueMDB() {
        
      System.out.println("Initializing HelloWorldQueueMDB");
        
      }
        
      public void onMessage(Message rcvMessage) {
        
      System.out.println("inside onMessage");
        LOGGER
      .warning("Message Received..............");
        
      TextMessage msg = null;
        
      try {
        
      System.out.println("message ");
        
      if (rcvMessage instanceof TextMessage) {
        msg
      = (TextMessage) rcvMessage;
        LOGGER
      .info("Received Message from queue: " + msg.getText());
        
      } else {
        LOGGER
      .warning("Message of wrong type: " + rcvMessage.getClass().getName());
        
      }
        
      } catch (JMSException e) {
        
      throw new RuntimeException(e);
        
      }
        
      }
      }

       

      I'm able to get the Initializing HelloWorldQueueMDBmessage, but I'm not getting ininside onMessage my logs.

      In the JBoss console under messaging, for the "Consumer Count " it is showing value as "0".