[Eventletdev] ZeroMQ!!!!

Ryan Williams breath at alum.mit.edu
Wed Oct 20 01:08:34 PDT 2010

Ben Ford just did something really clever: he got Eventlet to run on 
ZeroMQ!  This functionality will ship as a part of 0.9.13 later this 
week.  It's still pretty fresh, which is why there's no documentation 
for it yet.

So what does it mean to run on ZeroMQ?  Well, it means that you can use 
zeromq's supersockets nonblockingly from within a greenthread the same 
way we already do regular sockets.  Just fire up 'from eventlet.green 
import zmq' and get busy.

Zeromq has its own event hub for sockets, so we can do all the classy 
regular-socket greenness that Eventlet's always been about.  You can 
send and receive zmq messages from within a wsgi application, for 
example, without worrying about the whole process blocking.  You could 
write some really interesting game servers.  Maybe you could use it to 
send your important log lines to a central analysis tool.  Maybe you 
could use it to tame a shark, and train him to bullseye womp rats with a 
shoulder-mounted laser.  It's all up to you!

So here's how to get started with it:
* Install ZeroMQ, either from your package manager or from here: 
* Install pyzmq:  http://www.zeromq.org/bindings:python
* Get the latest version of eventlet: easy_install eventlet==dev
* Enable the zeromq hub, either by calling use_hub('zeromq') in your 
code, or setting the EVENTLET_HUB=zeromq environment variable.

Check out the two examples Ben wrote, they give a good idea of the 
* http://bitbucket.org/which_linden/eventlet/src/tip/examples/zmq_chat.py

Testing it is even a part of the continuous build now:  

More information about the Eventletdev mailing list