On 15 Sep 2010, at 13:45, [email protected] wrote:
I read some JMS tutorial and found that client id is used as durable
subscription. So I think it is useless if I don't use durable subscription, right? When I create a AMQPConnection, all its constructor require a client
id parameter. Why is it a mandatory parameter for AMQPConnection?

Because the JMS specification requires it and Qpid adheres to this specification. The API for 'javax.jms.Connection' states, among other things:

"The purpose of the client identifier is to associate a connection and its objects with a state maintained on behalf of the client by a provider. The only such state identified by the JMS API is that required to support durable subscriptions."

Additionally, the Connection is created *before* any subscriptions (durable or otherwise), producers or consumers are created. There is no way of saying "I want a Connection, but I promise never to use it with durable subscriptions" in JMS.

You should *not* be using 'AMQPConnection' in your code. You only need the Sun provided 'javax.jms.*' interface classes to communicate with Qpid unless you have very advanced requirements. Additionally, you should be using a 'ConnectionFactory' rather than constructing the connection object directly, this will allow you to leverage JNDI to manage different connections.

Please have a look at the Qpid documentation here:

http://qpid.apache.org/books/0.6/Programming-In-Apache-Qpid/html/ ch03.html

Andrew.
--
-- andrew d kennedy ? do not fold, bend, spindle, or mutilate ;

---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project:      http://qpid.apache.org
Use/Interact: mailto:[email protected]

Reply via email to