0 Replies Latest reply on Mar 23, 2004 5:50 PM by srinivasbv_gowda

    QueueRequestor and SpyTemporaryQueue implementation issue

    srinivasbv_gowda Newbie

      Hi ,

      We are using QueueRequestor to send messages. We we try to close thr requestor we get Warning Exception.

      Client request resulted in a server exception:
      javax.jms.InvalidDestinationException: The subscription was registered with a destination that does not exist !
      at org.jboss.mq.server.ClientConsumer.removeSubscription(ClientConsumer.java:246).


      Here is the piece of code which uses QueueRequestor


      public Object sendRequest(String requestQName, Object data) throws JMSException, NamingException {
      Queue requestQueue = (Queue) ctx.lookup(requestQName);
      QueueSession queueSession = queueConnection.createQueueSession(false, Session.AUTO_ACKNOWLEDGE);
      Message message = formatMessage(queueSession, data);
      QueueRequestor requestor = null;

      try {

      requestor = new QueueRequestor(queueSession, requestQueue);
      queueConnection.start();

      Message reply = requestor.request(message);

      return ((ObjectMessage) reply).getObject();
      } finally {
      if (requestor != null) {
      requestor.close();
      }
      }
      }




      This Warning is not seen is Websphere.

      We also found the possible cause.

      In The SpyTemporaryQueue delete method

      public void delete()
      throws JMSException
      {
      try
      {
      con.deleteTemporaryDestination(this);
      }
      catch(Exception e)
      {
      throw new SpyJMSException("Cannot delete the TemporaryQueue", e);
      }
      }

      tries to delete TemporaryDestination, but the reciever is not closed.

      In websphere it is Temporary queues are marked as closed but are not deleted.

      if we see the QueueRequestor class in the constructor it creates _replyQueue and _replyReceiver
      public QueueRequestor(QueueSession session, Queue queue)
      throws JMSException
      {
      _queueSession = null;
      _queue = null;
      _requestSender = null;
      _replyReceiver = null;
      _replyQueue = null;
      _queueSession = session;
      _queue = queue;
      _requestSender = _queueSession.createSender(_queue);
      _replyQueue = _queueSession.createTemporaryQueue();
      _replyReceiver = _queueSession.createReceiver(_replyQueue);
      }

      but while deleting _replyQueue it is not taken care to close _replyReceiver.

      I guess SpyTemporaryQueue should be taken care something like what websphere is used.

      Could any one you, have come across same problem and have found any fix please let us know.

      Thanks
      Srinivas