[zeromq-dev] patch for libpyzmq

Martin Sustrik sustrik at fastmq.com
Wed Jan 28 10:54:42 CET 2009


Erich,

> I have created small patch for pyzmq (it will apply cleanly to 0.4 and 
> trunk), which is attached below. This changes the return value of 
> ZMQ.receive.  Instead of only returning the message, it also returns the 
> queue_id. These return values are packed into a tuple, allowing the use 
> of the python idiom of:
> 
> queue_id, msg = ZMQinstance.receive() 
> 
> This allows for much more sophisticated use of zmq, without much change.

We've decider to add a new function not to break backward compatibility. 
Thus there's still receive fucntion working as it used to as well as 
receive2 function that works the way you've designed it.

In addition we've provided python help for the function (lines 219-225) 
and added you to the AUTHORS file.

Btw, before receive2 is stabilised, you may consider enhancing it by an 
option to do non-blocking message reception. All you have to do is to 
call C++ receive with 'block' parameter set to false and return (0, 
empty-message) pair in case no message was received.

Martin



More information about the zeromq-dev mailing list