You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@activemq.apache.org by Raffaele <r....@prismasw.it> on 2007/06/05 17:41:31 UTC

how find a queue?

Hi all,

I'm looking for a method to retrieve a specific queue based on its name,
that is a method that returns a Queue object.

In Oracle JMS implementation there is such a method, here it is:
http://www.stanford.edu/dept/itss/docs/oracle/10g/server.101/b12023/oracle/jms/AQjmsSession.html#getQueue(java.lang.String,%20java.lang.String)

In ActiveMQ does it exist analogous method?

Best regards and thanks,

Raffaele
-- 
View this message in context: http://www.nabble.com/how-find-a-queue--tf3872540s2354.html#a10972130
Sent from the ActiveMQ - User mailing list archive at Nabble.com.


Re: how find a queue?

Posted by James Strachan <ja...@gmail.com>.
On 6/6/07, Raffaele <r....@prismasw.it> wrote:
>
> I'm making a sort of wrapping of some of the main classes of ActiveMQ, in
> detail i have:
> - JMSWorker
>
> - QueueWorker extends JMSWorker
> - TopicWorker extends JMSWorker
>
> - QueueBrowser extends QueueWorker
> - QueueConsumer extends QueueWorker
> - QueueProducer extends QueueWorker
>
> - TopicConsumer extends TopicWorker
> - TopicPublisher extends TopicWorker
>
> This wrapping permits me to abstract my code from the JMS implementation, in
> fact till now I used Oracle JMS implementation and so, passing from Oracle
> to ActiveMQ should be as trasparent as possible using the above wrapper
> classes.

FWIW the purpose of the JMS API is to do exactly that, to avoid having
your code dependent on any particulary JMS provider.

If you want an easier facade on top of the JMS API I'd recommend
either the Spring JMS stuff, or Camel
http://activemq.apache.org/camel/

In particular
http://activemq.apache.org/camel/enterprise-integration-patterns.html
-- 
James
-------
http://macstrac.blogspot.com/

Re: how find a queue?

Posted by Raffaele <r....@prismasw.it>.
I'm making a sort of wrapping of some of the main classes of ActiveMQ, in
detail i have:
- JMSWorker 

- QueueWorker extends JMSWorker
- TopicWorker extends JMSWorker

- QueueBrowser extends QueueWorker
- QueueConsumer extends QueueWorker
- QueueProducer extends QueueWorker

- TopicConsumer extends TopicWorker
- TopicPublisher extends TopicWorker

This wrapping permits me to abstract my code from the JMS implementation, in
fact till now I used Oracle JMS implementation and so, passing from Oracle
to ActiveMQ should be as trasparent as possible using the above wrapper
classes.

Because of the constructor of QueueWorker is this:
public QueueWorker(String url, String queueName) throws JMSException {...}
and because QueueBrowser extends QueueWorker, I prefer having just the
queueName, then find that Queue and then I could instanciate a QueueBrowser.

I hope it's clear.

Thanks for the FAQ link in the other reply, I have understanded that I can
use createQueue without problems.

Best regards




jlim wrote:
> 
> Hi Raffaele,
> Just out of curiosity , what would you be doing with the Queue object?   
> If you already know the name of an existing queue then you can just use 
> Session.createQueue (or do a jndi lookup)  to get the queue object and  
> use it to create a |MessageConsumer| or a |MessageProducer| to 
> receive/send message  from/to that  queue.
> 
> Regards,
> Jonas
> 
> 
> 
> Raffaele wrote:
>> Hi,
>>
>> the createQueue method is implemented in this way:
>> public Queue createQueue(String queueName) throws JMSException {
>>          checkClosed();
>>          return new ActiveMQQueue(queueName);
>>      }
>>
>> And so, a new Object is created....Going deeper in the code I have seen
>> no
>> mechanism about retrieving already existing Queue based on its name.
>> Perhaps
>> am I wrong?
>>
>> Best regards,
>>
>> Raffaele
>>
>>
>> jlim wrote:
>>   
>>> Hi,
>>>
>>> If you just want to get the handle of a queue object based on its name I 
>>> think you can use  the Session.createQueue(String queueName)  method.
>>>
>>> Regards,
>>> jonas
>>>
>>> *
>>> *
>>>
>>>
>>>
>>> Raffaele wrote:
>>>     
>>>> Hi all,
>>>>
>>>> I'm looking for a method to retrieve a specific queue based on its
>>>> name,
>>>> that is a method that returns a Queue object.
>>>>
>>>> In Oracle JMS implementation there is such a method, here it is:
>>>> http://www.stanford.edu/dept/itss/docs/oracle/10g/server.101/b12023/oracle/jms/AQjmsSession.html#getQueue(java.lang.String,%20java.lang.String)
>>>>
>>>> In ActiveMQ does it exist analogous method?
>>>>
>>>> Best regards and thanks,
>>>>
>>>> Raffaele
>>>>   
>>>>       
>>>     
>>
>>   
> 
> 

-- 
View this message in context: http://www.nabble.com/how-find-a-queue--tf3872540s2354.html#a10984660
Sent from the ActiveMQ - User mailing list archive at Nabble.com.


Re: how find a queue?

Posted by Jonas Lim <jl...@exist.com>.
Hi Raffaele,
Just out of curiosity , what would you be doing with the Queue object?   
If you already know the name of an existing queue then you can just use 
Session.createQueue (or do a jndi lookup)  to get the queue object and  
use it to create a |MessageConsumer| or a |MessageProducer| to 
receive/send message  from/to that  queue.

Regards,
Jonas



Raffaele wrote:
> Hi,
>
> the createQueue method is implemented in this way:
> public Queue createQueue(String queueName) throws JMSException {
>          checkClosed();
>          return new ActiveMQQueue(queueName);
>      }
>
> And so, a new Object is created....Going deeper in the code I have seen no
> mechanism about retrieving already existing Queue based on its name. Perhaps
> am I wrong?
>
> Best regards,
>
> Raffaele
>
>
> jlim wrote:
>   
>> Hi,
>>
>> If you just want to get the handle of a queue object based on its name I 
>> think you can use  the Session.createQueue(String queueName)  method.
>>
>> Regards,
>> jonas
>>
>> *
>> *
>>
>>
>>
>> Raffaele wrote:
>>     
>>> Hi all,
>>>
>>> I'm looking for a method to retrieve a specific queue based on its name,
>>> that is a method that returns a Queue object.
>>>
>>> In Oracle JMS implementation there is such a method, here it is:
>>> http://www.stanford.edu/dept/itss/docs/oracle/10g/server.101/b12023/oracle/jms/AQjmsSession.html#getQueue(java.lang.String,%20java.lang.String)
>>>
>>> In ActiveMQ does it exist analogous method?
>>>
>>> Best regards and thanks,
>>>
>>> Raffaele
>>>   
>>>       
>>     
>
>   

Re: how find a queue?

Posted by James Strachan <ja...@gmail.com>.
On 6/6/07, Raffaele <r....@prismasw.it> wrote:
>
> Hi,
>
> the createQueue method is implemented in this way:
> public Queue createQueue(String queueName) throws JMSException {
>          checkClosed();
>          return new ActiveMQQueue(queueName);
>      }
>
> And so, a new Object is created....Going deeper in the code I have seen no
> mechanism about retrieving already existing Queue based on its name. Perhaps
> am I wrong?

This FAQ entry should clear up any confusion
http://activemq.apache.org/how-do-i-create-new-destinations.html

(basically client side objects != server side queues)

-- 
James
-------
http://macstrac.blogspot.com/

Re: how find a queue?

Posted by Raffaele <r....@prismasw.it>.
Hi,

the createQueue method is implemented in this way:
public Queue createQueue(String queueName) throws JMSException {
         checkClosed();
         return new ActiveMQQueue(queueName);
     }

And so, a new Object is created....Going deeper in the code I have seen no
mechanism about retrieving already existing Queue based on its name. Perhaps
am I wrong?

Best regards,

Raffaele


jlim wrote:
> 
> Hi,
> 
> If you just want to get the handle of a queue object based on its name I 
> think you can use  the Session.createQueue(String queueName)  method.
> 
> Regards,
> jonas
> 
> *
> *
> 
> 
> 
> Raffaele wrote:
>> Hi all,
>>
>> I'm looking for a method to retrieve a specific queue based on its name,
>> that is a method that returns a Queue object.
>>
>> In Oracle JMS implementation there is such a method, here it is:
>> http://www.stanford.edu/dept/itss/docs/oracle/10g/server.101/b12023/oracle/jms/AQjmsSession.html#getQueue(java.lang.String,%20java.lang.String)
>>
>> In ActiveMQ does it exist analogous method?
>>
>> Best regards and thanks,
>>
>> Raffaele
>>   
> 
> 

-- 
View this message in context: http://www.nabble.com/how-find-a-queue--tf3872540s2354.html#a10983740
Sent from the ActiveMQ - User mailing list archive at Nabble.com.


Re: how find a queue?

Posted by Jonas Lim <jl...@exist.com>.
Hi,

If you just want to get the handle of a queue object based on its name I 
think you can use  the Session.createQueue(String queueName)  method.

Regards,
jonas

*
*



Raffaele wrote:
> Hi all,
>
> I'm looking for a method to retrieve a specific queue based on its name,
> that is a method that returns a Queue object.
>
> In Oracle JMS implementation there is such a method, here it is:
> http://www.stanford.edu/dept/itss/docs/oracle/10g/server.101/b12023/oracle/jms/AQjmsSession.html#getQueue(java.lang.String,%20java.lang.String)
>
> In ActiveMQ does it exist analogous method?
>
> Best regards and thanks,
>
> Raffaele
>