Thanks, Pieter for your work in detecting this error. Actually, the intention here is not to send messages back to the client using the pub/sub model through main. (That would be a little absurd anyways.) It is to relay messages recieved from the client to servers on the back end for further processing. I dont think push/pull would work, as all these backend servers need to recieve all messages, not just the next available server. (This is useful for lookup services, when you dont know in which server to look.)
I resolved this by creating separate channels for each publisher skt in each worker thread named "inproc://publish%d", where the the %d is the worker thread number. Then the subscriber skt in the forwarder can just connect to each inproc://publish%d. Thanks again, dgs. On Sat, 2010-09-11 at 17:16 +0200, Pieter Hintjens wrote: > On Sat, Sep 11, 2010 at 4:48 PM, Jon Dyte <[email protected]> wrote: > > > however won't this example only work with one worker thread? > > (which is all it has, if you pthread_create another it'll fail to bind > > as the) > > Yes, in this example the workers send data back to the main code using > a pub/sub combo. I didn't fix that because I was looking for David's > error, not redesigning his architecture. > > You would not in practice use pubsub to send data back from 10 workers > to 1 main. You would use push/pull and connect all the workers to a > single collector socket in the main. I've changed the example now to > do that. It's now trivial to start more worker threads. > > So part of the problem here was also using the wrong pattern (pubsub > instead of pipeline). > > In fact it really is a pipeline pattern, since clients don't get > answers back but rather submit tasks that are pushed downstream. I'll > add this example to the user guide. > > -Pieter > _______________________________________________ > zeromq-dev mailing list > [email protected] > http://lists.zeromq.org/mailman/listinfo/zeromq-dev _______________________________________________ zeromq-dev mailing list [email protected] http://lists.zeromq.org/mailman/listinfo/zeromq-dev
