[zeromq-dev] Controlling thread affinity in a DEALER socket

Brad Taylor cbradtaylor at gmail.com
Fri Dec 21 00:22:16 CET 2012


In reviewing the guide, the multi-threaded patterns uses a proxy that has a DEALER socket for dealing the message to a worker.  We have a requirement to handle particular messages to particular threads.  That is the message can only be handled by a given thread.  Is there a simple pattern or technique, that would let us decide which backend socket to "deal" the message to?

In the bigger picture we want a multi threaded server, that listens on a single port.  There will be n-number of worker threads, where each worker thread can service requests for a given resource.  The resource is identifiable as part of the message.  We want to use the overall request-reply pattern.  That is the client issues a request, the server receives the message and passes the request to a specific worker thread, based upon message content.  The worker thread does the work and sends a reply to the client.  Thus we get parallelism in carrying out the work.  We have looke at some of the patterns.  However the "sockets are not thread-safe" statement worries us.

Any thoughts or guidance would be appreciated.

Thank  you

Brad Taylor 




More information about the zeromq-dev mailing list