You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@qpid.apache.org by jazzcat2 <jo...@globalherald.net> on 2008/01/29 21:46:53 UTC

Complete Example of Python QPid Usage??

Howdy Folks,

I'm looking for a complete simple example of how to, using Python-QPid:

1. Open connection to queue manager,
2. establish a send and recv queues,
3. Wait for msgs to appear on recv queue,
4. process answer,
5. Deposit msg on send queue.

I have hacked something together, and it is attached.  However, it doesn't
work.  When it gets to the client.start line on line 22, something in the
client.py code - specifically, when client.py tries to do a connection_open,
it raises a Closed exception.

Traceback (most recent call last):
  File
"/home/josh_dev/ide/eclipse/plugins/org.python.pydev.debug_1.3.11/pysrc/pydevd.py",
line 803, in ?
    debugger.run(setup['file'], None, None)
  File
"/home/josh_dev/ide/eclipse/plugins/org.python.pydev.debug_1.3.11/pysrc/pydevd.py",
line 655, in run
    execfile(file, globals, locals) #execute the script
  File "/home/josh_dev/Projects/app/src/app.py", line 83, in ?
    mqChannel = GetMQConnection()
  File "/home/josh_dev/Projects/app/src/app.py", line 44, in GetMQConnection
    mq_client.start('\0' + mqServerUser + '\0' + mqServerPass)
  File "/usr/lib/python2.4/site-packages/qpid/client.py", line 83, in start
    self.channel(0).connection_open(self.vhost)
  File "<string>", line 3, in connection_open
  File "/usr/lib/python2.4/site-packages/qpid/peer.py", line 182, in invoke
    raise Closed(self.reason)
qpid.peer.Closed

-- 
View this message in context: http://www.nabble.com/Complete-Example-of-Python-QPid-Usage---tp15169050p15169050.html
Sent from the Qpid Developers mailing list archive at Nabble.com.


Re: Complete Example of Python QPid Usage??

Posted by Gordon Sim <gs...@redhat.com>.
jazzcat2 wrote:
> Howdy Folks,
> 
> I'm looking for a complete simple example of how to, using Python-QPid:
> 
> 1. Open connection to queue manager,
> 2. establish a send and recv queues,
> 3. Wait for msgs to appear on recv queue,
> 4. process answer,
> 5. Deposit msg on send queue.
> 
> I have hacked something together, and it is attached.  However, it doesn't
> work.  When it gets to the client.start line on line 22, something in the
> client.py code - specifically, when client.py tries to do a connection_open,
> it raises a Closed exception.

What broker are you running it against? Can you send the output from the 
server?

I tried the code and with some minor tweaks got it running (at least to 
the point where the queues are created and the receive queue is 
subscribed to).

Re: Complete Example of Python QPid Usage??

Posted by Alan Conway <ac...@redhat.com>.
jazzcat2 wrote:
> Howdy Folks,
> 
> I'm looking for a complete simple example of how to, using Python-QPid:
> 
> 1. Open connection to queue manager,
> 2. establish a send and recv queues,
> 3. Wait for msgs to appear on recv queue,
> 4. process answer,
> 5. Deposit msg on send queue.
> 
> I have hacked something together, and it is attached.  However, it doesn't
> work.  When it gets to the client.start line on line 22, something in the
> client.py code - specifically, when client.py tries to do a connection_open,
> it raises a Closed exception.
> 
> Traceback (most recent call last):
>   File
> "/home/josh_dev/ide/eclipse/plugins/org.python.pydev.debug_1.3.11/pysrc/pydevd.py",
> line 803, in ?
>     debugger.run(setup['file'], None, None)
>   File
> "/home/josh_dev/ide/eclipse/plugins/org.python.pydev.debug_1.3.11/pysrc/pydevd.py",
> line 655, in run
>     execfile(file, globals, locals) #execute the script
>   File "/home/josh_dev/Projects/app/src/app.py", line 83, in ?
>     mqChannel = GetMQConnection()
>   File "/home/josh_dev/Projects/app/src/app.py", line 44, in GetMQConnection
>     mq_client.start('\0' + mqServerUser + '\0' + mqServerPass)
>   File "/usr/lib/python2.4/site-packages/qpid/client.py", line 83, in start
>     self.channel(0).connection_open(self.vhost)
>   File "<string>", line 3, in connection_open
>   File "/usr/lib/python2.4/site-packages/qpid/peer.py", line 182, in invoke
>     raise Closed(self.reason)
> qpid.peer.Closed
> 

There are a ton of examples in the python/tests* directories most pretty 
simple. Check the one thats appropriate to the amqp version of the 
broker you're using.



Re: Complete Example of Python QPid Usage??

Posted by jazzcat2 <jo...@globalherald.net>.

Whoops, forgot to upload the file.  Here it is.  Note that I've cut a few
things out to obfuscate it, but you get the general idea of what's going on.

http://www.nabble.com/file/p15169056/application.py application.py 
-- 
View this message in context: http://www.nabble.com/Complete-Example-of-Python-QPid-Usage---tp15169050p15169056.html
Sent from the Qpid Developers mailing list archive at Nabble.com.


Re: Complete Example of Python QPid Usage??

Posted by Josh <jo...@globalherald.net>.
Robert,

I was looking for a low-resource AMQ server; OpenAMQ didn't fit the bill 
because, even though it's C++, it is a resource hog, plus it's not quite 
compatible with the qPid libraries as I've noted on this list.  I'm going 
to start taking a look at RedHat's C++ QPid broker implementation.

Cheers,
-Josh


Re: Complete Example of Python QPid Usage??

Posted by Robert Greig <ro...@gmail.com>.
On 01/02/2008, Josh <jo...@globalherald.net> wrote:

> I had originally thought that maybe OpenAMQ wasn't exactly what I was
> looking for.  I then began looking for the C++ Qpid AMQ broker but
> couldn't find it; it's good to see that RedHat is releasing packages that
> (hopefully) provide a compatible end-to-end solution.

Hi Josh,

Could you let us know your requirements? We are about to do some
improvements to our web pages and we would like to make sure that our
documentation directs people to the right Qpid tools and products
based on their target use cases.

RG

Re: Complete Example of Python QPid Usage??

Posted by Josh <jo...@globalherald.net>.
THANKS Jonathan for forwarding that link.

I had originally thought that maybe OpenAMQ wasn't exactly what I was 
looking for.  I then began looking for the C++ Qpid AMQ broker but 
couldn't find it; it's good to see that RedHat is releasing packages that 
(hopefully) provide a compatible end-to-end solution.

Cheers,
-J

Re: Complete Example of Python QPid Usage??

Posted by Jonathan Robie <jo...@redhat.com>.
This may be helpful:

http://www.redhat.com/docs/manuals/en-US/Red_Hat_Enterprise_MRG/1.0/html/Messaging_Tutorial/Messaging_Tutorial-Using_RHM_with_Python.html

Jonathan

jazzcat2 wrote:
> Howdy Folks,
>
> I'm looking for a complete simple example of how to, using Python-QPid:
>
> 1. Open connection to queue manager,
> 2. establish a send and recv queues,
> 3. Wait for msgs to appear on recv queue,
> 4. process answer,
> 5. Deposit msg on send queue.
>
> I have hacked something together, and it is attached.  However, it doesn't
> work.  When it gets to the client.start line on line 22, something in the
> client.py code - specifically, when client.py tries to do a connection_open,
> it raises a Closed exception.
>
> Traceback (most recent call last):
>   File
> "/home/josh_dev/ide/eclipse/plugins/org.python.pydev.debug_1.3.11/pysrc/pydevd.py",
> line 803, in ?
>     debugger.run(setup['file'], None, None)
>   File
> "/home/josh_dev/ide/eclipse/plugins/org.python.pydev.debug_1.3.11/pysrc/pydevd.py",
> line 655, in run
>     execfile(file, globals, locals) #execute the script
>   File "/home/josh_dev/Projects/app/src/app.py", line 83, in ?
>     mqChannel = GetMQConnection()
>   File "/home/josh_dev/Projects/app/src/app.py", line 44, in GetMQConnection
>     mq_client.start('\0' + mqServerUser + '\0' + mqServerPass)
>   File "/usr/lib/python2.4/site-packages/qpid/client.py", line 83, in start
>     self.channel(0).connection_open(self.vhost)
>   File "<string>", line 3, in connection_open
>   File "/usr/lib/python2.4/site-packages/qpid/peer.py", line 182, in invoke
>     raise Closed(self.reason)
> qpid.peer.Closed
>
>