[rabbitmq-discuss] Wrapping pika callbacks, why ?
Gavin M. Roy
gmr at meetme.com
Mon Aug 6 16:55:58 BST 2012
On Monday, August 6, 2012 at 10:29 AM, Raphaël De Giusti wrote:
> Hi everyone,
>
> I'm interested in running pika's IOLoop in a thread and I came across this code sample : http://cms02.phys.ntu.edu.tw/tracs/env/browser/trunk/messaging/pika/mon.py
>
> I was wondering why and what could be the advantages of wrapping the callbacks in methods (I can understand the on_exchange_declared() method that returns a different callback according to thread's name) ?
As opposed to doing lambda's for callbacks? I'm not sure of the context of what you're comparing callback passing style to.
> Another question is why considering multiprocessing over threading in this case ?
>
>
The IOLoop is a singleton instance and you will run into contention issues and non-thread safe behaviors in use of the IOLoop and event processing.
I'm not sure what threading buys you in an asynchronous event based model of processing but needless complexity.
Gavin
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rabbitmq.com/pipermail/rabbitmq-discuss/attachments/20120806/892657d7/attachment.htm>
More information about the rabbitmq-discuss
mailing list