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