[rabbitmq-discuss] Using SelectConnection to simulate a blocking "basic_get"

Michael Klishin michael at rabbitmq.com
Wed Aug 28 20:13:22 BST 2013

Matt Pietrek:

> Is this sane? Are there examples of how I might do this?


I'm not very familiar with Pika implementation but believe this approach
means you will create a new connection for every delivery. That will be
really inefficient (less than using basic.get).

Maybe running Pika I/O loop in a separate thread would be sufficient?
The only inconvenient part about this is how to gracefully make it shut down
but this can be done.

If you want to have a caller blocking API that uses basic.consume and basic.cancel,
consider using condition variables, e.g. as in [1] (which is not Python but hopefully
close enough).

1. https://github.com/rabbitmq/rabbitmq-tutorials/blob/master/ruby/rpc_client.rb
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 495 bytes
Desc: Message signed with OpenPGP using GPGMail
URL: <http://lists.rabbitmq.com/pipermail/rabbitmq-discuss/attachments/20130828/3eafb4b5/attachment.pgp>

More information about the rabbitmq-discuss mailing list