[Twisted-Python] Integrating Twisted with ZeroMQ

Itamar Turner-Trauring itamar at itamarst.org
Sun Jun 6 23:17:49 EDT 2010


On Sun, 2010-06-06 at 21:59 +0200, Laurens Van Houtven wrote:

> pyzmq offers something called select, which works just like select
> except it works on both file descriptors and ZeroMQ Sockets. It just
> delegates all of the work to libzmq. We could use
> ThreadedSelectReactor and have it use ZMQ's select. I'm not sure if it
> should use "normal" select everywhere else: because zmq's select is in
> fact much better than select.select (it just behaves like
> select.select in the sense that you give it three sets of fds and an
> optional timeout; under the hood it's actually epoll or kqueue or
> whatever) and it can handle plain old file descriptors just fine. So,
> you'd have a TRS with either 1 zmq.select running on everything or 1
> zmq.select running over Sockets and 1 select.select running over your
> classic fds. Personally I kind of like the idea of zmq's select taking
> over, but I don't know how well that works in practice.

You should probably just make a ZeroMQ reactor, instead of using TSR,
which (in its current form) is an ugly hack. TSR buys you nothing
because, unfortunately, it doesn't let you hook up to arbitrary
reactors. 

If the API really is select() compatible this presumably would be a
fairly trivial subclass of the reactor in
twisted.internet.selectreactor.





More information about the Twisted-Python mailing list