0 Replies Latest reply on Mar 13, 2006 2:29 AM by scotto

    javax.jms.Session and Temporary Queues from a MDB?

      Hello.

      I am porting some code that previously ran as a MBean to use the EJB 3.0 MDB MessageListener interface.

      Previously, my MBean would maintain its own JMS Connection and Session objects, however as an MDB, it appears I can only access the Message object itself. Is this correct?


      In order to send an asynchronous response to a message, I previously use d the following code:

      Destination tempDestination = msg.getJMSReplyTo();
      
      // Create a temporary producer
      MessageProducer tempProducer = session.createProducer(tempDestination);
      
      // Send the message
      ObjectMessage objMsg = session.createObjectMessage(ack);
      tempProducer.send(objMsg);
      
      // Close our temporary producer
      tempProducer.close();
      


      Now this code can only work if I have the same Session object that was used to receive the message prior to being passed to the onMessage() method.

      Does anyone know how can I do this from an EJB3 MDB onMessage() handler?

      Thanks!