0
我正在嘗試在python-rq
的工作任務內設置一個zmq
套接字。在rq worker中使用ZMQ
如果我創建context
任務函數內部:
def push(user, task_id, data):
"""Push message to `user` over websocket.
"""
ctx = zmq.Context()
pub = ctx.socket(zmq.PUB)
pub.connect('ipc:///tmp/message_flow_in')
pub.send(b"0 " + json.dumps({'username': user,
'id': task_id,
'data': data
}
).encode('utf-8')
)
的pub.send()
調用不起任何作用。
您是否嘗試過使用**'tcp' ** - 基於**'flags = zmq.NOBLOCK' **的傳輸類進行診斷的相同場景(即使對於兩個對等節點都託管相同的本地主機)? – user3666197