You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@qpid.apache.org by Leglise Yann <yl...@sopragroup.com> on 2009/08/19 14:16:35 UTC

Mixing up AMQP QPID and JMS

Hello,
 
I had sent a previous mail in the beginning of July concerning an AMQP version problem between client and broker.
It is OK for this point, but now I am realizing that the things are still not so clear for me.
Here are some assertions I believe as being true (please tell me if I am wrong):

*	AMQP is mainly inspired by JMS, and specifiy an implentation independent protocol for queue messaging,
*	QPID is an implementation of AMQP available for several languages (i.e. C++, java, python ...),
*	It is possible to write a QPID java client using JMS objects only (i.e. writing a java program with not a single org.apache.qpid.* import, even if the qpid jars are necessary for execution at least for the JNDI initialization that refer to org.apache.qpid.jndi.PropertiesFileInitialContextFactory),
*	QPID java examples make use, in majority, of JMS,
*	For QPID java example that does not make use of JMS (amqpexample package), the client and the broker must use the same AMQP version (I mean, if the broker does not handle the AMQP version used by the client, no communciation can take place),

 
So here are my questions:

1.	What is the links between QPID and JMS (How is it that using only JMS objects, QPID libraries are used)?
2.	Is the AMQP version negociation allowed by JMS and not by QPID?

 
I really thank you in advance for your answers.
 
Best regards,

Yann LEGLISE
Agence STIE - Division Midi-Pyrénées
Sopra group.	
1 Avenue André Marie Ampère
BP 10134 - 31772 Colomiers Cedex
(Bureau 1C16)
Phone : +33 (0)5 34 56 71 07
yleglise@sopragroup.com - www.sopragroup.com <http://www.sopragroup.com/> 
Ce message peut contenir des informations confidentielles dont la divulgation est à ce titre rigoureusement interdite en l'absence d'autorisation explicite de l'émetteur. Dans l'hypothèse où vous auriez reçu par erreur ce message, merci de le renvoyer à l'émetteur et de détruire toute copie.

P Pensez à l'environnement avant d'imprimer.	
 

Re: Mixing up AMQP QPID and JMS

Posted by Jonathan Robie <jo...@redhat.com>.
Leglise Yann wrote:
> Hello Robert,
>
> I am not particulary trying to create queues dynamically. I am in fact trying to determine if by using the JMS QPID implementation leads to an AMQP compliant behaviour. I mean, by using JMS, as soon as a use a consumer on an non-existing queue, this queue is automatically created in the broker. Would this happen if I used "low level" QPID java, or C++ or python?
> As we discussed before, QPID is an implementation of AMQP, so I expected that whichever was the underlying language or library used, the use of QPID would lead to the same result, i.e. the behaviour specified in AMQP.
> As I have read that in AMQP queues should be explicitely declared, I was just wondering if the automatic queue creation achieved through JMS was acceptable since it was not the behaviour described by AMQP, or in other words, I am wondering if the JMS QPID implementation is AMQP compliant.

AMQP is an interoperable protocol, it does not define an API.  Java JMS 
is an API, it does not define an interoperable protocol.

Our Java JMS implementation uses vanilla AMQP, as defined by the AMQP 
specification. It implements the Java JMS API. Because Java JMS says 
queues can be declared implicitly, we have to execute the appropriate 
AMQP commands to ensure that a non-existing queue is declared if need be.

The C++, and Python APIs are based more directly on the AMQP commands, 
and do not implicitly declare queues. I believe this is the same of the 
low-level Java API (but I admit I didn't check before sending this email).

Jonathan

---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project:      http://qpid.apache.org
Use/Interact: mailto:users-subscribe@qpid.apache.org


RE: Mixing up AMQP QPID and JMS

Posted by Leglise Yann <yl...@sopragroup.com>.
Hello Robert,

I am not particulary trying to create queues dynamically. I am in fact trying to determine if by using the JMS QPID implementation leads to an AMQP compliant behaviour. I mean, by using JMS, as soon as a use a consumer on an non-existing queue, this queue is automatically created in the broker. Would this happen if I used "low level" QPID java, or C++ or python?
As we discussed before, QPID is an implementation of AMQP, so I expected that whichever was the underlying language or library used, the use of QPID would lead to the same result, i.e. the behaviour specified in AMQP.
As I have read that in AMQP queues should be explicitely declared, I was just wondering if the automatic queue creation achieved through JMS was acceptable since it was not the behaviour described by AMQP, or in other words, I am wondering if the JMS QPID implementation is AMQP compliant.

Regards.


Yann LEGLISE

-----Message d'origine-----
De : Robert Greig [mailto:robert.j.greig@gmail.com] 
Envoyé : mercredi 19 août 2009 20:13
À : users@qpid.apache.org
Objet : Re: Mixing up AMQP QPID and JMS

2009/8/19 Leglise Yann <yl...@sopragroup.com>:

> 2) If it is, are both implementations equivalent and compliant with AMQP the same way? I am asking because using JMS, when you create a Consumer on a queue that is not declared as an administered object, this queue is created in the broker.

This isn't generally the case, it is dependent on the message broker you are using. Nearly all brokers will have permissions to limit which clients can create queues.

> I believe this a a normal JMS behaviour, but I have read somewhere that in AMQP, queues must be explicitly declared, what I understood by "if queues are not explicitly declared, they cannot be used".

This is likely referring to the underlying protocol. Higher level APIs such as JMS are designed to shield the developer from the low level details.

Are you trying to write an application that requires queues be created dynamically at run-time by a client?

Robert

---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project:      http://qpid.apache.org
Use/Interact: mailto:users-subscribe@qpid.apache.org


---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project:      http://qpid.apache.org
Use/Interact: mailto:users-subscribe@qpid.apache.org


Re: Mixing up AMQP QPID and JMS

Posted by Robert Greig <ro...@gmail.com>.
2009/8/19 Leglise Yann <yl...@sopragroup.com>:

> 2) If it is, are both implementations equivalent and compliant with AMQP the same way? I am asking because using JMS, when you create a Consumer on a queue that is not declared as an administered object, this queue is created in the broker.

This isn't generally the case, it is dependent on the message broker
you are using. Nearly all brokers will have permissions to limit which
clients can create queues.

> I believe this a a normal JMS behaviour, but I have read somewhere that in AMQP, queues must be explicitly declared, what I understood by "if queues are not explicitly declared, they cannot be used".

This is likely referring to the underlying protocol. Higher level APIs
such as JMS are designed to shield the developer from the low level
details.

Are you trying to write an application that requires queues be created
dynamically at run-time by a client?

Robert

---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project:      http://qpid.apache.org
Use/Interact: mailto:users-subscribe@qpid.apache.org


Re: Mixing up AMQP QPID and JMS

Posted by Jonathan Robie <jo...@redhat.com>.
Leglise Yann wrote:
> Hello once again :)
>
> Here are some additional questions arisen from your answers.
> 1) As there are java example that does not make use of JMS objects, I suppose that QPID also furnish another AMQP implementation that is independent from JMS?
>   

Yes, there is also a "low level" Java API that is more similar to the 
C++ and Python APIs. It is not widely used, though, and is not well 
documented. Most Java users use the Java JMS APIs.

> 2) If it is, are both implementations equivalent and compliant with AMQP the same way? I am asking because using JMS, when you create a Consumer on a queue that is not declared as an administered object, this queue is created in the broker. I believe this a a normal JMS behaviour, but I have read somewhere that in AMQP, queues must be explicitly declared, what I understood by "if queues are not explicitly declared, they cannot be used".
>   

If you use the Java JMS APIs, you get Java JMS behavior, we implement it 
using AMQP. If you want to directly invoke the AMQP primitives, you can 
use the low level API, but be aware that you'll be one of few doing so, 
and you'll have to figure things out with less documentation etc.

Jonathan

---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project:      http://qpid.apache.org
Use/Interact: mailto:users-subscribe@qpid.apache.org


RE: Mixing up AMQP QPID and JMS

Posted by Leglise Yann <yl...@sopragroup.com>.
Hello once again :)

Here are some additional questions arisen from your answers.
1) As there are java example that does not make use of JMS objects, I suppose that QPID also furnish another AMQP implementation that is independent from JMS?
2) If it is, are both implementations equivalent and compliant with AMQP the same way? I am asking because using JMS, when you create a Consumer on a queue that is not declared as an administered object, this queue is created in the broker. I believe this a a normal JMS behaviour, but I have read somewhere that in AMQP, queues must be explicitly declared, what I understood by "if queues are not explicitly declared, they cannot be used".

Thank you.


Best regards
-----Message d'origine-----
De : Gordon Sim [mailto:gsim@redhat.com] 
Envoyé : mercredi 19 août 2009 17:22
À : users@qpid.apache.org
Objet : Re: Mixing up AMQP QPID and JMS

Leglise Yann wrote:
> Thank you Gordon.
> 
> Your answers helped, but I want to make it a little bit clearer about the relation between QPID and JMS.
> I can only see 2 possible interpretation of the relation between JMS and QPID (one will necessarily be wrong):
> 1)  QPID relies on (i.e. make use of) a JMS implementation in order to 
> use the JMS services to satisfy the AMQP purposes,
> 2)  QPID actually IS a JMS implementation that directly includes the AMQP required behaviour.

Option 2 is the correct one.

> This is confusing for me since in my java program, I am linked to a jms.jar (gotten from the J2EE SDK), in association with the qpid jars, and I suppose this jms.jar contains a JMS implementation (leading to the first interpretation).
> 
> So in the case 1), I cannot understand how a JMS object (that does not "know" I am using a QPID jar) can interact with an AMQP broker (I mean, when I invoke a send API on a javax.jms.MessageProducer, how is it that Wireshark detects AMQP frames? The meaning of my question in my previous mail was to understand how could the JMS objects (defined, according to me, in the jms.jar) could interact with the QPID jars (I supposed that the AMQP frames are sent by some classes of the QPID jars) since nothing is (apparently) made to link JMS object with QPID classes).
> 
> In case 2), why should I need using the jms.jar if the implementation already exists in the QPID jars?
> 
> The only explanation I can imagine is that the jms.jar is used only for the interfaces like Connection, Session etc. some implementors of which resides in QPID library that are used because using org.apache.qpid.jndi.PropertiesFileInitialContextFactory in JNDI. Then, as every used object (ConnectionFactory, Destination ...) are obtained through a first QPID class implementing the InitialContext, this implementing class also choose a QPID class implementing those interfaces (and so on for Connection, Queue ...). This is what I guess, but I would like to have a confirmation from someone who "knows".

Yes, assuming you mean the geronimo-jms_1.1_spec-1.0.jar, that is correct. It contains only the interface definitions.

---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project:      http://qpid.apache.org
Use/Interact: mailto:users-subscribe@qpid.apache.org


---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project:      http://qpid.apache.org
Use/Interact: mailto:users-subscribe@qpid.apache.org


Re: Mixing up AMQP QPID and JMS

Posted by Gordon Sim <gs...@redhat.com>.
Leglise Yann wrote:
> Thank you Gordon.
> 
> Your answers helped, but I want to make it a little bit clearer about the relation between QPID and JMS.
> I can only see 2 possible interpretation of the relation between JMS and QPID (one will necessarily be wrong):
> 1)  QPID relies on (i.e. make use of) a JMS implementation in order to use the JMS services to satisfy the AMQP purposes,
> 2)  QPID actually IS a JMS implementation that directly includes the AMQP required behaviour.

Option 2 is the correct one.

> This is confusing for me since in my java program, I am linked to a jms.jar (gotten from the J2EE SDK), in association with the qpid jars, and I suppose this jms.jar contains a JMS implementation (leading to the first interpretation).
> 
> So in the case 1), I cannot understand how a JMS object (that does not "know" I am using a QPID jar) can interact with an AMQP broker (I mean, when I invoke a send API on a javax.jms.MessageProducer, how is it that Wireshark detects AMQP frames? The meaning of my question in my previous mail was to understand how could the JMS objects (defined, according to me, in the jms.jar) could interact with the QPID jars (I supposed that the AMQP frames are sent by some classes of the QPID jars) since nothing is (apparently) made to link JMS object with QPID classes).
> 
> In case 2), why should I need using the jms.jar if the implementation already exists in the QPID jars?
> 
> The only explanation I can imagine is that the jms.jar is used only for the interfaces like Connection, Session etc. some implementors of which resides in QPID library that are used because using org.apache.qpid.jndi.PropertiesFileInitialContextFactory in JNDI. Then, as every used object (ConnectionFactory, Destination ...) are obtained through a first QPID class implementing the InitialContext, this implementing class also choose a QPID class implementing those interfaces (and so on for Connection, Queue ...). This is what I guess, but I would like to have a confirmation from someone who "knows".

Yes, assuming you mean the geronimo-jms_1.1_spec-1.0.jar, that is 
correct. It contains only the interface definitions.

---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project:      http://qpid.apache.org
Use/Interact: mailto:users-subscribe@qpid.apache.org


RE: Mixing up AMQP QPID and JMS

Posted by Leglise Yann <yl...@sopragroup.com>.
Thank you Gordon.

Your answers helped, but I want to make it a little bit clearer about the relation between QPID and JMS.
I can only see 2 possible interpretation of the relation between JMS and QPID (one will necessarily be wrong):
1)  QPID relies on (i.e. make use of) a JMS implementation in order to use the JMS services to satisfy the AMQP purposes,
2)  QPID actually IS a JMS implementation that directly includes the AMQP required behaviour.

This is confusing for me since in my java program, I am linked to a jms.jar (gotten from the J2EE SDK), in association with the qpid jars, and I suppose this jms.jar contains a JMS implementation (leading to the first interpretation).

So in the case 1), I cannot understand how a JMS object (that does not "know" I am using a QPID jar) can interact with an AMQP broker (I mean, when I invoke a send API on a javax.jms.MessageProducer, how is it that Wireshark detects AMQP frames? The meaning of my question in my previous mail was to understand how could the JMS objects (defined, according to me, in the jms.jar) could interact with the QPID jars (I supposed that the AMQP frames are sent by some classes of the QPID jars) since nothing is (apparently) made to link JMS object with QPID classes).

In case 2), why should I need using the jms.jar if the implementation already exists in the QPID jars?

The only explanation I can imagine is that the jms.jar is used only for the interfaces like Connection, Session etc. some implementors of which resides in QPID library that are used because using org.apache.qpid.jndi.PropertiesFileInitialContextFactory in JNDI. Then, as every used object (ConnectionFactory, Destination ...) are obtained through a first QPID class implementing the InitialContext, this implementing class also choose a QPID class implementing those interfaces (and so on for Connection, Queue ...). This is what I guess, but I would like to have a confirmation from someone who "knows".


Thank you.


Yann LEGLISE

-----Message d'origine-----
De : Gordon Sim [mailto:gsim@redhat.com] 
Envoyé : mercredi 19 août 2009 16:11
À : users@qpid.apache.org
Objet : Re: Mixing up AMQP QPID and JMS

Leglise Yann wrote:
> Hello,

Hello!

> I had sent a previous mail in the beginning of July concerning an AMQP version problem between client and broker.
> It is OK for this point, but now I am realizing that the things are still not so clear for me.
> Here are some assertions I believe as being true (please tell me if I am wrong):
> 
> *	AMQP is mainly inspired by JMS, and specifiy an implentation independent protocol for queue messaging,


Correct; AMQP is an implementation independent protocol for message queueing applications.

I'm not sure whether all those behind AMQP would say they were 'inspired' by JMS(!). However I think it's fair to say that JMS has always been an important use case for AMQP.

> *	QPID is an implementation of AMQP available for several languages (i.e. C++, java, python ...),

Correct.

> *	It is possible to write a QPID java client using JMS objects only (i.e. writing a java program with not a single org.apache.qpid.* import, even if the qpid jars are necessary for execution at least for the JNDI initialization that refer to org.apache.qpid.jndi.PropertiesFileInitialContextFactory),

Correct.

> *	QPID java examples make use, in majority, of JMS,

The java examples do, yes.

> *	For QPID java example that does not make use of JMS (amqpexample package), the client and the broker must use the same AMQP version (I mean, if the broker does not handle the AMQP version used by the client, no communciation can take place),

Correct.

> So here are my questions:
> 
> 1.	What is the links between QPID and JMS (How is it that using only JMS objects, QPID libraries are used)?

I'm not entirely sure I understand the question, so forgive me if I state the obvious or go off in the wrong direction!

JMS is an implementation independent API. A JMS client library will implement all the interfaces required by JMS and will map those to some underlying network protocol used to communicate with a broker.

The Qpid JMS client library maps the interface to particular interactions using AMQP. (If you are looking for details of that mapping, I'll leave that to another mail and perhaps another person...)

> 2.	Is the AMQP version negociation allowed by JMS and not by QPID?

AMQP defines a simple version check that can be used to ensure the client and server are agreed on the version to be used. It may well be that there are some bugs around that but expected behaviour is that you can point the Qpid JMS client at an AMQP broker and it will negotiate which of the supported versions it will use.

Hope this helps, if not please keep asking questions! Thanks for your interest!

--Gordon.

---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project:      http://qpid.apache.org
Use/Interact: mailto:users-subscribe@qpid.apache.org


---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project:      http://qpid.apache.org
Use/Interact: mailto:users-subscribe@qpid.apache.org


Re: Mixing up AMQP QPID and JMS

Posted by Gordon Sim <gs...@redhat.com>.
Leglise Yann wrote:
> Hello,

Hello!

> I had sent a previous mail in the beginning of July concerning an AMQP version problem between client and broker.
> It is OK for this point, but now I am realizing that the things are still not so clear for me.
> Here are some assertions I believe as being true (please tell me if I am wrong):
> 
> *	AMQP is mainly inspired by JMS, and specifiy an implentation independent protocol for queue messaging,


Correct; AMQP is an implementation independent protocol for message 
queueing applications.

I'm not sure whether all those behind AMQP would say they were 
'inspired' by JMS(!). However I think it's fair to say that JMS has 
always been an important use case for AMQP.

> *	QPID is an implementation of AMQP available for several languages (i.e. C++, java, python ...),

Correct.

> *	It is possible to write a QPID java client using JMS objects only (i.e. writing a java program with not a single org.apache.qpid.* import, even if the qpid jars are necessary for execution at least for the JNDI initialization that refer to org.apache.qpid.jndi.PropertiesFileInitialContextFactory),

Correct.

> *	QPID java examples make use, in majority, of JMS,

The java examples do, yes.

> *	For QPID java example that does not make use of JMS (amqpexample package), the client and the broker must use the same AMQP version (I mean, if the broker does not handle the AMQP version used by the client, no communciation can take place),

Correct.

> So here are my questions:
> 
> 1.	What is the links between QPID and JMS (How is it that using only JMS objects, QPID libraries are used)?

I'm not entirely sure I understand the question, so forgive me if I 
state the obvious or go off in the wrong direction!

JMS is an implementation independent API. A JMS client library will 
implement all the interfaces required by JMS and will map those to some 
underlying network protocol used to communicate with a broker.

The Qpid JMS client library maps the interface to particular 
interactions using AMQP. (If you are looking for details of that 
mapping, I'll leave that to another mail and perhaps another person...)

> 2.	Is the AMQP version negociation allowed by JMS and not by QPID?

AMQP defines a simple version check that can be used to ensure the 
client and server are agreed on the version to be used. It may well be 
that there are some bugs around that but expected behaviour is that you 
can point the Qpid JMS client at an AMQP broker and it will negotiate 
which of the supported versions it will use.

Hope this helps, if not please keep asking questions! Thanks for your 
interest!

--Gordon.

---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project:      http://qpid.apache.org
Use/Interact: mailto:users-subscribe@qpid.apache.org