You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@activemq.apache.org by michael_hk <hk...@yahoo.co.jp> on 2006/09/15 04:44:11 UTC

[newbie] Confused: javax.jms.Message vs ActiveMQMessage

Hi,

I just started to learn JMS and am confused by javax.jms.Message and
ActiveMQMessage. I know Message is an interface and ActiveMQMessage is a
class implementing the Message interface. But I don't know when to use
which? I only saw most examples using Message.

Similar problems for Destination vs ActiveMQDestination, Queue vs
ActiveMQQueue. Thanks for your time.

Michael
-- 
View this message in context: http://www.nabble.com/-newbie--Confused%3A-javax.jms.Message-vs-ActiveMQMessage-tf2275210.html#a6318401
Sent from the ActiveMQ - User forum at Nabble.com.


Re: [newbie] Confused: javax.jms.Message vs ActiveMQMessage

Posted by michael_hk <hk...@yahoo.co.jp>.
Hi Adrian,

Thanks for your clear explanation.

Michael


Adrian Co wrote:
> 
> Hi,
> 
> Usually you use the interface (Message and Destination), if you want 
> your JMS client to be JMS vendor neutral. You use ActiveMQMessage and 
> ActiveMQDestination if you want to use ActiveMQ specific functions or 
> properties. Downside is it will be harder to port to another JMS 
> provider as you are using ActiveMQ specific classes.
> 
> Another difference is you could instantiate directly ActiveMQMessage and 
> ActiveMQQueue. i.e. Queue q = new ActiveMQQueue("TEST.FOO");
> But to be vendor neutral, you should use 
> session.createQueue("TEST.FOO"),  which will return a Queue object, but 
> the actual implementation is still ActiveMQQueue.
> 
> Hope these helps.
> 
> michael_hk wrote:
>> Hi,
>>
>> I just started to learn JMS and am confused by javax.jms.Message and
>> ActiveMQMessage. I know Message is an interface and ActiveMQMessage is a
>> class implementing the Message interface. But I don't know when to use
>> which? I only saw most examples using Message.
>>
>> Similar problems for Destination vs ActiveMQDestination, Queue vs
>> ActiveMQQueue. Thanks for your time.
>>
>> Michael
>>   
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/-newbie--Confused%3A-javax.jms.Message-vs-ActiveMQMessage-tf2275210.html#a6318805
Sent from the ActiveMQ - User forum at Nabble.com.


Re: [newbie] Confused: javax.jms.Message vs ActiveMQMessage

Posted by Adrian Co <ac...@exist.com>.
Hi,

Usually you use the interface (Message and Destination), if you want 
your JMS client to be JMS vendor neutral. You use ActiveMQMessage and 
ActiveMQDestination if you want to use ActiveMQ specific functions or 
properties. Downside is it will be harder to port to another JMS 
provider as you are using ActiveMQ specific classes.

Another difference is you could instantiate directly ActiveMQMessage and 
ActiveMQQueue. i.e. Queue q = new ActiveMQQueue("TEST.FOO");
But to be vendor neutral, you should use 
session.createQueue("TEST.FOO"),  which will return a Queue object, but 
the actual implementation is still ActiveMQQueue.

Hope these helps.

michael_hk wrote:
> Hi,
>
> I just started to learn JMS and am confused by javax.jms.Message and
> ActiveMQMessage. I know Message is an interface and ActiveMQMessage is a
> class implementing the Message interface. But I don't know when to use
> which? I only saw most examples using Message.
>
> Similar problems for Destination vs ActiveMQDestination, Queue vs
> ActiveMQQueue. Thanks for your time.
>
> Michael
>