3 Replies Latest reply on Jul 28, 2004 4:44 AM by schrouf

    JMS-Request/Reply from SessionBean

    schrouf

      From within a simple SessionBean I am trying to 'emulate' a synchronous request/reply communication with an external legacy system on JBoss3.2.5.

      The session bean creates a temporary queue, stores the reference within the JMS request message (JMSReplyTo) and sends the request to a global request queue.

      The legacy system processes the request and sends the reply back to the client specific temporary reply queue, from where it should be delivered to the waiting ( aReceiver.receive(lTimeout) ) session bean.

      But unfortunately the reply actually DOES NOT get delivered to the waiting session bean. The reply message is succesfully inserted into the temporary queue by the server but the receiving session bean still receives a timeout ?!? Any ideas ?

      Here is the code (simple enough)

      ....
      ...
      try
      {
       aConnection = rQueueFactory.createQueueConnection();
      
       aSession = aConnection.createQueueSession(false,QueueSession.AUTO_ACKNOWLEDGE);
      
       aSender = aSession.createSender(rRequestQueue);
       aReplyQueue = aSession.createTemporaryQueue();
       aReceiver = aSession.createReceiver(aReplyQueue);
      
       aConnection.start();
      
       aRequestMessage = aSession.createTextMessage();
      
       aRequestMessage.setJMSDeliveryMode(DeliveryMode.NON_PERSISTENT);
       aRequestMessage.setJMSReplyTo(aReplyQueue);
       aRequestMessage.setText(rRequest.getAction());
      
       aSender.send(aRequestMessage);
      
       aReplyMessage = (TextMessage) aReceiver.receive(lTimeout);
      
       sResult = aReplyMessage.getText();
      }
      catch (JMSException eEx)
      {
      
      }
      


      Regards
      Ulf

        • 1. Re: JMS-Request/Reply from SessionBean

          Read the javadoc: aConnection.start()

          • 2. Re: JMS-Request/Reply from SessionBean

            Sorry, I see you already have it.

            I'd suggest you post the reply logic and also check it is actually sending
            the message to the queue. See "READ THIS FIRST" for how to debug.

            You might also try the example on the WIKI.

            • 3. Re: JMS-Request/Reply from SessionBean
              schrouf

              Hi adrian,

              thanks for your reply. Finally I found the reason, why it doesn't worked as expected. Seems like it was primarily a hot deployment problem, as my bugfixed session bean code wasn't used by the server. Instead an older code version ( without the aConnection.start() :-) was still used by the server ever after bugfixing ...

              A simple server shutdown, delete of temp directory and a restart solved all problems :-)

              Regards
              Ulf