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

Andrew Hume andrew at research.att.com
Sat Oct 8 03:25:06 CEST 2011


simplest is best.
simply add another PULL socket to the ventilator for receiving tasks.
workers can PUSH tasks to this socket.
the ventilator simply gets tasks from this socket and adds to the normal socket.

On Oct 7, 2011, at 5:09 PM, James Thornton wrote:

> 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
> _______________________________________________
> zeromq-dev mailing list
> zeromq-dev at lists.zeromq.org
> http://lists.zeromq.org/mailman/listinfo/zeromq-dev


------------------
Andrew Hume  (best -> Telework) +1 623-551-2845
andrew at research.att.com  (Work) +1 973-236-2014
AT&T Labs - Research; member of USENIX and LOPSA




-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.zeromq.org/pipermail/zeromq-dev/attachments/20111007/d126de43/attachment.htm>


More information about the zeromq-dev mailing list