You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@qpid.apache.org by mARK bLOORE <mb...@gmail.com> on 2009/06/24 00:55:56 UTC

how to connect to na AMQP 0.8 server?

i am trying to connect to a RabbitMQ (AMQP 0.8) server, with username
and password.  taking code from the 'hello-world' example, i do

sock = connect(broker, port)
conn = Connection(sock, qpid.spec.load("qpid-0.5/specs/amqp.0-8.xml"),
username=user, password=password)

and get
AttributeError: Spec instance has no attribute '__getitem__'
from delegates.py line 34.  i note that the traceback includes
connection.py, rather than connection08.py, if that matters.

i have also tried using a different approach, with a Client object,
following code shown at
http://www.balisage.net/Proceedings/html/2008/Robie01/Balisage2008-Robie01.html,
but that produces different errors, which make me think that it is
only good for 0.10.

can anyone tell me how to connect Qpid 0.5 to an AMQP 0.8 server?

-- 
mARK bLOORE <mb...@gmail.com>

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


Re: how to connect to na AMQP 0.8 server?

Posted by Gordon Sim <gs...@redhat.com>.
mARK bLOORE wrote:
> i am trying to connect to a RabbitMQ (AMQP 0.8) server, with username
> and password.  taking code from the 'hello-world' example, i do
> 
> sock = connect(broker, port)
> conn = Connection(sock, qpid.spec.load("qpid-0.5/specs/amqp.0-8.xml"),
> username=user, password=password)
> 
> and get
> AttributeError: Spec instance has no attribute '__getitem__'
> from delegates.py line 34.  i note that the traceback includes
> connection.py, rather than connection08.py, if that matters.
> 
> i have also tried using a different approach, with a Client object,
> following code shown at
> http://www.balisage.net/Proceedings/html/2008/Robie01/Balisage2008-Robie01.html,
> but that produces different errors, which make me think that it is
> only good for 0.10.
> 
> can anyone tell me how to connect Qpid 0.5 to an AMQP 0.8 server?
> 

The API for connecting is slightly different for pre 0-10 specs. To 
connect try the following (note that the 0.5 qpid release uses a 
modified version of the amqp 0-8 spec, so if you are running against 
rabbit you should use the official version of that specification):

import qpid.client, qpid.spec
import Queue
from qpid.content import Content

client = qpid.client.Client("localhost", 5672, 
qpid.spec.load("/path/to/amqp.0-8.xml"))
client.start({"LOGIN":"guest","PASSWORD":"guest"})

channel = client.channel(1)
channel.channel_open()

Then you can invoke any AMQP 0-8 methods on the channel. The methods 
exposed here are dynamically determined based on the spec loaded. 
Attached is a full hello world example in case that is useful. You may 
also find the tests under tests_0-8 useful as examples.

FYI there is work underway to offer a high level, protocol independent 
API for python to avoid having to deal with these differences.


Re: how to connect to na AMQP 0.8 server?

Posted by mARK bLOORE <mb...@gmail.com>.
Thank you, Carl, Aidan, and Gordon.  Using the proper spec and the sample
code Gordon posted has gotten me up and running.  My needs are quite simple,
so I probably won't have to go into things deeply enough to understand just
why it works, though I may find an excuse to do so anyway.

-- 
mARK bLOORE <mb...@gmail.com>

Re: how to connect to na AMQP 0.8 server?

Posted by Aidan Skinner <ai...@gmail.com>.
On Wed, Jun 24, 2009 at 10:19 AM, Gordon Sim <gs...@redhat.com> wrote:

> Aidan Skinner wrote:
>
>> On Wed, Jun 24, 2009 at 2:37 AM, Carl Trieloff <cctrieloff@redhat.com
>> >wrote:
>>
>>  Here is the matrix of what versions AMQP versions Qpid supports
>>>
>>> http://qpid.apache.org/download.html
>>>
>>> for python, you need to load the spec file for the version broker you
>>> want
>>> to talk to. The python
>>> client can talk all versions of AMQP except 0-9-1
>>>
>>>
>> Is there a reason why it couldn't talk 0-9-1 if it was fed that spec?
>>
>
> The 0-9-1 spec 'helpfully' redefined the protocol negotiation header
> format.


Ugh. That's annoying.

- Aidan

-- 
Apache Qpid - AMQP, JMS, other messaging love http://qpid.apache.org
"A witty saying proves nothing" - Voltaire

Re: how to connect to na AMQP 0.8 server?

Posted by Gordon Sim <gs...@redhat.com>.
Aidan Skinner wrote:
> On Wed, Jun 24, 2009 at 2:37 AM, Carl Trieloff <cc...@redhat.com>wrote:
> 
>> Here is the matrix of what versions AMQP versions Qpid supports
>>
>> http://qpid.apache.org/download.html
>>
>> for python, you need to load the spec file for the version broker you want
>> to talk to. The python
>> client can talk all versions of AMQP except 0-9-1
>>
> 
> Is there a reason why it couldn't talk 0-9-1 if it was fed that spec?

The 0-9-1 spec 'helpfully' redefined the protocol negotiation header format.


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


Re: how to connect to na AMQP 0.8 server?

Posted by Aidan Skinner <ai...@gmail.com>.
On Wed, Jun 24, 2009 at 2:37 AM, Carl Trieloff <cc...@redhat.com>wrote:

>
> Here is the matrix of what versions AMQP versions Qpid supports
>
> http://qpid.apache.org/download.html
>
> for python, you need to load the spec file for the version broker you want
> to talk to. The python
> client can talk all versions of AMQP except 0-9-1
>

Is there a reason why it couldn't talk 0-9-1 if it was fed that spec?

- Aidan
-- 
Apache Qpid - AMQP, JMS, other messaging love http://qpid.apache.org
"A witty saying proves nothing" - Voltaire

Re: how to connect to na AMQP 0.8 server?

Posted by Carl Trieloff <cc...@redhat.com>.
Here is the matrix of what versions AMQP versions Qpid supports

http://qpid.apache.org/download.html

for python, you need to load the spec file for the version broker you 
want to talk to. The python
client can talk all versions of AMQP except 0-9-1

Carl.

mARK bLOORE wrote:
> i am trying to connect to a RabbitMQ (AMQP 0.8) server, with username
> and password.  taking code from the 'hello-world' example, i do
>
> sock = connect(broker, port)
> conn = Connection(sock, qpid.spec.load("qpid-0.5/specs/amqp.0-8.xml"),
> username=user, password=password)
>
> and get
> AttributeError: Spec instance has no attribute '__getitem__'
> from delegates.py line 34.  i note that the traceback includes
> connection.py, rather than connection08.py, if that matters.
>
> i have also tried using a different approach, with a Client object,
> following code shown at
> http://www.balisage.net/Proceedings/html/2008/Robie01/Balisage2008-Robie01.html,
> but that produces different errors, which make me think that it is
> only good for 0.10.
>
> can anyone tell me how to connect Qpid 0.5 to an AMQP 0.8 server?
>
>   


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