1 Reply Latest reply on May 16, 2008 12:21 PM by Adrian Brock

    MDB that makes a nested asynchronous request/reply times out

    Arthur Vernon Newbie

      I have for several days been trying to get this scenaio to work...
      MDB 1 receives a message
      MDB 1 sends a message and waits for a reply

      MDB 2 receives the message, determines the response
      MDB 2 replies on the reply to queue specified.

      The message is posted on the queue that same second
      (I checked the WSMQ Explorer to confirm the exact time)

      MDB 1 times out several seconds later (timeout period)

      This is shown below with JBoss DEBUG logging enabled.

      If I run the exact same code as a simple Java application to obtain the reply MDB 1 is expecting then it works fine... What could possibly be wrong? Can anyone suggest anything?




      22:49:33,296 DEBUG [BaseMDB]
      Reply ID: (ID:414d5120484254657374514d332020200089054820024402)
      <?xml version="1.0" encoding="UTF-8"?><HB_EAI_REPLY><HB_EAI_HEADER version="1.0" created="2008-04-16T22:49:33" r
      eturnCode="3001"/></HB_EAI_REPLY>

      22:49:33,296 DEBUG [RepositoryClassLoader] setRepository, repository=org.jboss.mx.loading.HeirarchicalLoaderRepository3@
      18c28a, cl=org.jboss.mx.loading.HeirarchicalLoaderRepository3$CacheClassLoader@bccad2{ url=null ,addedOrder=0}
      22:49:33,296 INFO [STDOUT] >>>>>>>>>>>>>>>>>>>> the message has been placed on queue:///BANK_REPLY.QL
      22:49:33,296 INFO [STDOUT] DONE ON MEssage>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
      22:49:33,296 DEBUG [ManagedEntityManagerFactory] ************** closing entity managersession **************
      22:49:37,218 INFO [STDOUT] Where is my message? It should have been onqueue:///BANK_REPLY.QL
      22:49:37,218 WARN [XmlHelper] Service: CustomerRetrievalReply timeout occurred for service: CustomerRetrieval. JMS ID:
      ID:414d5120484254657374514d332020200089054820024402
      22:49:37,218 INFO [IvrAccountHandler] [0002] Missing account for userID: 1
      22:49:37,218 INFO [STDOUT] ***********class ae.hilal.j2ee.mdb.ProductionMDB-3686138 connection: 12455934


      Here is the test code that works...
      package ae.hilal.eai.spi;

      import java.util.Properties;

      import javax.jms.JMSException;
      import javax.jms.QueueConnection;
      import javax.jms.QueueReceiver;
      import javax.jms.QueueSession;
      import javax.jms.TextMessage;

      import org.apache.log4j.Logger;

      import com.ibm.mq.jms.JMSC;
      import com.ibm.mq.jms.MQQueue;
      import com.ibm.mq.jms.MQQueueConnectionFactory;

      public class TestMQ {

      private static final long serialVersionUID = -7743081529785780978L;

      private static final Logger log = Logger.getLogger(TestMQ.class);

      private TestMQ() {
      }

      public static void main(String[] args) throws JMSException
      {

      System.out.println("What is it? " + JMSC.MQJMS_EXP_UNLIMITED);
      System.out.println("What is it? " + JMSC.MQJMS_EXP_APP);

      MQQueueConnectionFactory qcf =new MQQueueConnectionFactory();
      Properties props = new Properties();
      props.put("ConnectionFactory.ConnectionMode", "Client");
      props.put("ConnectionFactory.Client.HostName", "localhost");
      props.put("ConnectionFactory.Client.QueueManagerName", "HBTestQM3");
      props.put("ConnectionFactory.Client.Channel", "HILALBANKCLIENTCONN");
      props.put("ConnectionFactory.Client.Port", "1513");




      String connectionMode = props
      .getProperty("ConnectionFactory.ConnectionMode");
      if ("Bind".equals(connectionMode)) {
      log.info("Using Bind mode for MQ connection.");
      qcf.setTransportType(JMSC.MQJMS_TP_BINDINGS_MQ);
      } else {
      String hostname = props
      .getProperty("ConnectionFactory.Client.HostName");
      String queueManagerName = props
      .getProperty("ConnectionFactory.Client.QueueManagerName");
      String channel = props
      .getProperty("ConnectionFactory.Client.Channel");
      String port = props
      .getProperty("ConnectionFactory.Client.Port");

      Integer portNo = null;
      if (port != null)
      try
      {
      portNo = Integer.parseInt(port);
      }
      catch (NumberFormatException ex)
      {
      System.out.println("Invalid port number: " + port);
      }

      System.out.println("Using Client mode for MQ connection. host: "
      + hostname + " QMName: " + queueManagerName
      + " Channel: " + channel + " Port: " + port);

      qcf.setTransportType(JMSC.MQJMS_TP_CLIENT_MQ_TCPIP);
      // qcf.setQueueManager(queueManagerName);
      qcf.setHostName(hostname);
      // qcf.setChannel(channel);
      if (portNo != null)
      qcf.setPort(portNo);
      }


      try
      {
      QueueConnection connection = qcf.createQueueConnection();
      connection.start();

      QueueSession s = connection.createQueueSession(false, QueueSession.AUTO_ACKNOWLEDGE);
      QueueReceiver receiver = s.createReceiver(new MQQueue("BANK_REPLY.QL"));

      System.out.println(":Reading off " + receiver.getQueue());
      TextMessage msg = (TextMessage) receiver.receive(3);

      System.out.println(msg.getText());

      } catch (JMSException e) {
      e.getLinkedException().printStackTrace();
      // e.printStackTrace();
      throw e;
      }

      }

      }