4 Replies Latest reply on Jul 18, 2004 2:34 PM by Stephane Nicoll

    JMS Receive method Issue

    arghre sergyr Newbie

      Hi,

      I do have some code related to JMS in my stateless session, basically in one method I am dumping some info into queue and in the other method I am retrieving the information from the same queue. The sender part goes fine without any problems, but it is NOT retrieving any information in the receive method. Below is the complete information:

      JBoss version: jboss-3.0.4

      QueueConntection factory userd: ConnectionFactory

      The queue info is provided in the jbossmq-destinations-service.xml

      With the bean, the resource ref are defined in the deployment descriptors as below in ejb-jar.xml

      <transaction-type>Bean</transaction-type>
      <resource-ref>
      Default QueueFactory
      <res-ref-name>java:comp/env/jms/QueueConnectionFactory</res-ref-name>
      <res-type>javax.jms.QueueConnectionFactory</res-type>
      <res-auth>Container</res-auth>
      </resource-ref>


      And as below in jboss.xml

      <resource-ref>
      <res-ref-name>java:comp/env/jms/QueueConnectionFactory</res-ref-name>
      <jndi-name>ConnectionFactory</jndi-name>
      </resource-ref>

      the code is referring the connection factory as below:

      queueConnectionFactory = (QueueConnectionFactory) envContext.lookup("ConnectionFactory");

      which gets executed properly and the sending info is

      QueueSender queueSender = queueSession.createSender(userTaskSenderQueue);

      queueSender.send(mapMessage);

      queueSender.close();

      and receive part is

      QueueSession queueSession = queueConnectionFactory.createQueueConnection().createQueueSession(false, Session.AUTO_ACKNOWLEDGE);

      QueueReceiver queueReceiver = queueSession.createReceiver(userTaskSenderQueue);

      Message receivedMsg = queueReceiver.receive();



      But it goes in the hanged stage when we call the receive method, I am not sure whether message is posted into the queue or not and whether the problem is to do with the receive method.

      Your help is highly appreciated!

      Thanks,
      Arshad