[zeromq-dev] freelance(ish) pattern, java and threading

Peter Friend pfriend at gehrytech.com
Tue Nov 27 20:36:01 CET 2012


I am using something similar to the freelance pattern with ROUTER->ROUTER sockets. On what I am calling the "worker" end of things the messages are fetched, processed then the reply sent back. I am in Java Land so to get more concurrency I will have a pool of threads processing these requests. The single thread loop to read messages and dispatch to threads is fine, but I need to get the reply coded correctly. The process already has sockets connected to the various clients, and I know these should not be shared among the threads.

>From the docs I read about creating a local DEALER socket then having each thread create their own socket that connects to that via inproc. What I can't figure out is how to attach that DEALER socket to the various ROUTER sockets I have with clients. It doesn't look like setting up the proxy will work since I have multiple ROUTER sockets to deal with. What I need is for the socket in each thread to be able to write it's response to the correct client ROUTER socket. It almost sounds like I need another ROUTER socket bound to inproc which the threads can connect to, then the main polling loop can pass from inproc to the clients.

Not sure if what I wrote makes sense. :-) Thanks in advance for pointers.

Peter

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


More information about the zeromq-dev mailing list