[zeromq-dev] What's the right way for a worker to send additional tasks to the worker queue?

James Thornton james at jamesthornton.com
Sat Oct 8 02:09:17 CEST 2011


In the taskevent model (ventilator/worker/sink), what's the right way
for a *worker* to send additional tasks to the worker queue?

I'm working off of this example...

https://github.com/taotetek/blog_examples/blob/master/python_multiprocessing_with_zeromq/workqueue_example.py

And I've tried having the worker connect to the PUSH socket the
ventilator is bound to, but that doesn't seem to work.

def worker(wrk_num):
    # Initialize a zeromq context
    context = zmq.Context()

    # This doesn't work...
    ventilator_send = context.socket(zmq.PUSH)
    ventilator_send.connect("tcp://127.0.0.1:5557")

    # Set up a channel to receive work from the ventilator
    work_receiver = context.socket(zmq.PULL)
    work_receiver.connect("tcp://127.0.0.1:5557")

...

Thanks.

- James



More information about the zeromq-dev mailing list