[zeromq-dev] Multi-threaded ZeroMQ applications
thijsterlouw at gmail.com
Thu Apr 1 19:10:17 CEST 2010
Thanks for the tips! I now changed to XREP socket + 2x InProc
(Up/Down) and it works great.
I will consider moving to REP-style worker-threads later; but I was
afraid REP-style would mean that only 1 thread would be active at any
moment (due to the send/recv requirement)? With my current design, I
don't have this problem.
I've been busy reading the source code, trying to figure out how it
comes XREP actually works :) I finally figured it out, and in the
process I created a schematic UML diagram of the ZeroMQ code base.
I've attached it, perhaps it's useful for others as well. I'll
probably update it later with more details.
On Thu, Apr 1, 2010 at 2:16 PM, Martin Sustrik <sustrik at 250bpm.com> wrote:
> You'll have to do a bit of hacking to get this working. However, the
> functionality is under development (priority no.1) and hopefully it should
> be available shortly.
> 1. Don't use the trunk version. This part of functionality is being worked
> on and it's broken in trunk. Use 2.0.6 instead.
> 2. To implement your "message dispatcher thread" have a look at
> devices/zmq_queue/zmq_queue.cpp - it does exactly what you need.
> 3. On the REP side (worker threads) you'll have to do some manual tweaking
> of the messages. Each request you'll get is prefixed by identity of the
> endpoint that have originally generated it. It's in form of
> <1-byte-size><identity>. You have to get it from the message and use it as a
> prefix for the reply you are going to send.
> John Dyte has this scenario working so ha may have more advice.
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 150874 bytes
Desc: not available
More information about the zeromq-dev