queue_vs_zmq.py 文件源码

python
阅读 26 收藏 0 点赞 0 评论 0

项目:tasker 作者: wavenator 项目源码 文件源码
def zmq_streamer():
    try:
        context = zmq.Context()
        # Socket facing clients
        frontend = context.socket(zmq.PUSH)
        frontend.bind("tcp://*:%s" % (zmq_queue_port_push))
        # Socket facing services
        backend = context.socket(zmq.PULL)
        backend.bind("tcp://*:%s" % (zmq_queue_port_pull))

        zmq.device(zmq.STREAMER, frontend, backend)
    except Exception as e:
        print(e)
        print("bringing down zmq device")
    finally:
        frontend.close()
        backend.close()
        context.term()
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号