veegee / amqpy

Pure-Python 2 & 3 AMQP client library
http://amqpy.readthedocs.org/
Other
32 stars 5 forks source link

Add more examples #7

Open veegee opened 9 years ago

veegee commented 9 years ago

Add more examples in examples directory and update Sphinx docs with better examples.

philipaconrad commented 7 years ago

Are there any obvious examples you might be interested in seeing built?

I use RabbitMQ on the side for a project, and have used this library heavily for services that listen on exchanges for work to come in. I could easily adapt some of that code into usage examples, if you are interested. I've had to get creative when pulling down messages from multiple queues due to the single-threaded model of the library, but thus far things have worked out.

When I was using this library for the first time, I can think of a few things I would have loved to see documented, preferably with examples:

veegee commented 7 years ago

Sure! Feel free to contribute whatever you think is best. Any help would be much appreciated!

I have to rework the internals of this library to allow for more efficient multithreading. The best way to go about it is via Go-style channels and a Go-style select over the channels. I'm open to any suggestions regarding the implementation of this.

philipaconrad commented 7 years ago

I'm in the process of porting over the RabbitMQ tutorial examples, and the first 5 were relatively straightforward since amqpy's API is fairly similar to pika's.

However, I ran into a problem porting their RPC demonstration. It seems to rely on message recipients being able to see fields like reply_to and correlation_id.

From what I can see in amqpy's channel.py, these fields are set sender-side, but are not visible to receivers. For now, I can probably hack around the issue using application headers or something.

It seems to me like this might be something to provide under Message.delivery_info, since fields like exchange and routing_key are available from there.

Thoughts?

pryano commented 7 years ago

I've used reply_to and correlation_id successfully, on the sending and receiving side (both sides using amqpy). They are stored on the Message.properties dictionary and can be retrieved by name there.