I am trying to make a ZeroMQ PUSH-PULL event management in Django. Based on this link, I will be creating a PUSH client as :
context = zmq.Context()
zmq_socket = context.socket(zmq.PUSH)
zmq_socket.connect("tcp://127.0.0.1:5557")
for num in xrange(20000):
work_message = { 'num' : num }
zmq_socket.send_json(work_message)
and a PULL server as:
context = zmq.Context()
consumer_receiver = context.socket(zmq.PULL)
consumer_receiver.bind("tcp://127.0.0.1:5557")
work = consumer_receiver.recv_json()
data = work['num']
print data
Implementing PUSH/PULL in a separate file works fine. But I want the PULL server functionality in Django views. That is, whenever a message is received, I want it to be received on Django and I can operate Django ORM. How do I handle this? Thanks.