txZMQ - ØMQ for Twisted¶
txZMQ allows to integrate easily ØMQ sockets into Twisted event loop (reactor).
txZMQ supports both CPython and PyPy, and ØMQ library version 2.2.x or 3.2.x.
txZMQ introduces support for general 0MQ sockets by class txzmq.ZmqConnection that can do basic event loop integration, sending-receiving messages in non-blocking manner, scatter-gather for multipart messages.
txZMQ uses ØMQ APIs to get file descriptor that is used to signal pending actions from ØMQ library IO thread running in separate thread. This is used in a custom file descriptor reader, which is then added to the Twisted reactor.
From this class, one may implement the various patterns defined by ØMQ. For example, special descendants of the txzmq.ZmqConnection class, txzmq.ZmqPubConnection and txzmq.ZmqSubConnection, add special nice features for PUB/SUB sockets.
Other socket types could be easily derived from txzmq.ZmqConnection.