Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add more examples #7

Open
veegee opened this issue Mar 20, 2015 · 4 comments
Open

Add more examples #7

veegee opened this issue Mar 20, 2015 · 4 comments
Milestone

Comments

@veegee
Copy link
Owner

veegee commented Mar 20, 2015

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

@veegee veegee modified the milestone: v1.1 Mar 20, 2015
@philipaconrad
Copy link

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:

  • Similar examples to RabbitMQ's tutorial examples.

    These cover a huge breadth of use cases for AMQP, and when I first started using this library, I had their examples open in one set of browser tabs, and the amqpy docs open in another set of tabs. Even if these are examples not mirrored over wholesale, they at least illustrate common topics.

    • Hello World :: Basic producer/consumer over a queue, no exchanges.
    • Work Queue :: 1 producer, 2 consumers, no exchanges.
    • Publish/Subscribe :: 1 producer, 1 fanout exchange, 2 consumers.
    • Routing :: 1 producer, 1 direct exchange, 2 consumers, routing keys introduced.
    • Topics :: 1 producer, 1 topic exchange, 2 consumers, different binding keys.
    • RPC :: 1 client, 1 server, 2 queues. RPC work handled in client/server code.
  • Creating a custom consumer (Maybe one that deserializes and prints JSON or Msgpack formats).

  • Single client listening on multiple queues.

  • Single client pulling from 1+ queues and pushing messages to 1+ queues.

  • Example illustrating when to use single versus multiple channels on a given connection.

  • Example(s) using threading or multiprocessing and/or gevent in tandem with the library for concurrent work.

@veegee
Copy link
Owner Author

veegee commented Dec 31, 2016

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
Copy link

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
Copy link

pryano commented Feb 23, 2017

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants