5 Replies Latest reply on Mar 1, 2004 11:42 AM by ionel

    problem using TemporaryQueue

    ionel Newbie

      Hi there,

      I have a problem using TemporaryQueues.

      Here is my scenario :
      Client1 creates a queue on JBoss and connects as a consumer.
      The queue name is sent to client2 which use it to act as the producer.
      Client2 connects to the given queue, sends datas through it, close and disconnect.
      Client1, after receiving what it asked for, close and disconnect then destroy the queue.

      This scenario works smoothly when Client1 creates the queue using the RMI adaptor but failed with TemporaryQueue.

      JBoss TemporaryQueue names follow this pattern : JMS_TQ<unique_number>

      I tried to connect to JMS_TQ# and queue/JMS_TQ# but when creating the producer, it hangs for the server to connect back to itself.

      004-03-01 14:07:39,696 [MessageListenerThread - willy/ondemand] DEBUG com.clickoptions.teproxy.jms.proxy.P
      roxyOnDemandSubscriber - dictionary request received for queue queue/JMS_TQ11
      2004-03-01 14:07:39,791 [MessageListenerThread - willy/ondemand] DEBUG org.jboss.mq.referenceable.SpyConnec
      tionFactoryObjectFactory - Extracting SpyConnectionFactory from reference
      2004-03-01 14:07:39,803 [MessageListenerThread - willy/ondemand] DEBUG org.jboss.mq.referenceable.SpyConnec
      tionFactoryObjectFactory - The GenericConnectionFactory is: GenericConnectionFactory:[server=org.jboss.mq.i
      l.oil.OILServerIL@3cf62,connectionProperties={OIL_TCPNODELAY_KEY=yes, PingPeriod=60000, OIL_PORT_KEY=8090,
      ClientILService=org.jboss.mq.il.oil.OILClientILService, OIL_ADDRESS_KEY=}]
      2004-03-01 14:07:39,810 [MessageListenerThread - willy/ondemand] DEBUG org.jboss.mq.GenericConnectionFactor
      y - Handing out ClientIL: org.jboss.mq.il.oil.OILClientILService
      2004-03-01 14:07:39,810 [OILClientILService-6] DEBUG org.jboss.mq.il.oil.OILClientILService - Waiting for t
      he server to connect to me on port 38546

      Surprisingly, when using RMI-created queues, the server connection occurs almost immediatly.

      Another point is : the queue initialization is made inside the object constructor (which extends java.lang.Thread) and the creator can call the start() method whereas initialization sequence is not finished.

      Why couldn't I use the temporary queue ?
      Why does the producer hangs during initialization and why can I call a method on an object that is not totally initialized ?


        • 1. Re: problem using TemporaryQueue
          ionel Newbie

          I found that Client2 (the one which is sent the queue name and which tries to connect as producer) throws a NamingException - NameNotFoundException because it can't find the specified queue. (neither queue/JMS_TQ# nor JMS_TQ#)

          The QueueConnection is still not closed or destroyed so the temporary queue should not be "dead".

          According to the Javadoc :

          It is a system-defined queue that can be consumed only by the QueueConnection that created it.

          This is what I do but the producer is another QueueConnection.
          Does it matter ?

          I don't see why another client could not see the queue.


          • 2. Re: problem using TemporaryQueue
            Adrian Brock Master

            Temporaries are not bound into jndi.


            • 3. Re: problem using TemporaryQueue
              ionel Newbie


              I tried this :

              TemporaryQueue tempoQueue = queueSession.createTemporaryQueue();
              Queue queue = queueSession.createQueue(tempoQueue.getQueueName());

              I am still getting NameNotFoundException - JMS_TQ# not bound.

              I also tried :
              Queue queue = queueSession.createQueue("dummyname");

              but I got this error message :
              2004-03-01 17:20:50,034 [main] ERROR com.clickoptions.teconsole.jms.TEConsoleConsumer - JMSException
              org.jboss.mq.SpyJMSException: Cannot get the Queue from the provider; - nested throwable: (javax.jms.JMSException: This destination does not exist !)
              at org.jboss.mq.SpyConnection.createQueue(SpyConnection.java:216)
              at org.jboss.mq.SpyQueueSession.createQueue(SpyQueueSession.java:92)
              at com.clickoptions.teproxy.jms.queue.AbstractConsumer.<init>(AbstractConsumer.java:92)
              at com.clickoptions.teproxy.jms.queue.ConsoleConsumer.<init>(ConsoleConsumer.java:16)
              at com.clickoptions.teconsole.jms.TEConsoleConsumer.<init>(TEConsoleConsumer.java:27)
              at com.clickoptions.teconsole.TEDataSource.<init>(TEDataSource.java:184)
              at com.clickoptions.teconsole.TEConsole.<init>(TEConsole.java:214)
              at com.clickoptions.teconsole.TEConsole.main(TEConsole.java:1838)
              + nested throwable:
              javax.jms.JMSException: This destination does not exist !
              <<no stack trace available>>

              so I guess the first solution (temporary queue THEN createQueue using the temporary queue name) is what to do.

              Unfortunatly, it still fails.

              I see no output of the temporary queue binding in the jndi space.

              Did I miss something ?

              • 4. Re: problem using TemporaryQueue
                Adrian Brock Master

                ionel how can you get a jndi exception when you are no longer doing jndi?

                In future, please make sure you analyse the problem before knee-jerking
                every exception into this forum.


                • 5. Re: problem using TemporaryQueue
                  ionel Newbie


                  Thanks for your help, I got it working. I simply did the createQueue() on the remote client (the one that did not create the temporary queue)

                  My error was to think that the createQueue had to be done by the side that created the temporary queue instead of the other side. To me, a remote client has to do jndi lookups to retrieve the created queues (like when the queue was created using jmx)

                  Knowledge is the sum of all the errors you made.

                  I made this one once, slap me if I reiterate, not because I'm trying.

                  Again, thanks for your help.