-
1. Re: TemporaryQueue access from another connection possible?
timfox Jan 17, 2010 1:00 PM (in response to vlpp)Firstly - you shouldn't be using HornetQ internal objects directly.
Please stick to the API objects (these are the ones in the api package)
http://hornetq.sourceforge.net/docs/hornetq-2.0.0.GA/api/
It's not possible using the JMS API to create a temp queue with a specific name - this is not a limitation of HornetQ it's just how the JMS API is.
However you can do this using the core API. Problem is you are mixing and matching the two.
-
2. Re: TemporaryQueue access from another connection possible?
timfox Jan 17, 2010 1:01 PM (in response to timfox)If you want to use the JMS API you will need to create a temp queue using the normal JMS means, then send the temp queue name in a message.
The other end can then consume that message and it will know the name of the temp queue.
-
3. Re: TemporaryQueue access from another connection possible?
timfox Jan 17, 2010 1:12 PM (in response to timfox)What you could do (but it is a bit hacky and I don't recommend it), is create your temp queue using the core api with the name "jms.queue.mytempqueue" (you can change the mytempqueue part to what you want).
Then that queue will be available using the JMS api with the name "mytempqueue" (without the jms.queue part).
Also see http://hornetq.sourceforge.net/docs/hornetq-2.0.0.GA/user-manual/en/html/jms-core-mapping.html - basically jms queues map to core queues with the prefix "jms.queue"
-
4. Re: TemporaryQueue access from another connection possible?
vlpp Jan 17, 2010 1:39 PM (in response to timfox)Thank you very much for the answer. If I create a temp queue with the core api I'm still not able to use the name from the second connection:
TemporaryQueue mytempq = coreSession.createTemporaryQueue();
MessageConsumer consumer = coreSession.createConsumer(mytempq);
consumer.setMessageListener(new QueueHandler());
Session session = cf.createConnection().createSession(false, Session.AUTO_ACKNOWLEDGE);MessageProducer producer = session.createProducer(session.createQueue(mytempq.getQueueName()));
from what I understood you recommended something like this - am I doing something wrong? I still receive "there is no queue with name ..."
-
5. Re: TemporaryQueue access from another connection possible?
timfox Jan 17, 2010 1:49 PM (in response to vlpp)Firstly there is no method createTemporaryQueue() on the core API, so I don't know what you mean here.
I suggest reading the chapter on core messaging in the user manual to understand the differences between address and queue names.
You send messages to an address, not a queue name
-
6. Re: TemporaryQueue access from another connection possible?
timfox Jan 17, 2010 1:50 PM (in response to timfox)See http://hornetq.sourceforge.net/docs/hornetq-2.0.0.GA/user-manual/en/html/using-core.html#d0e14441 of 1 people found this helpful -
7. Re: TemporaryQueue access from another connection possible?
vlpp Jan 17, 2010 2:28 PM (in response to timfox)I think I understood what you mean, sorry for mixing the things - now looks that it works. Thanks a lot!