[zeromq-dev] Broadcasting Requests

Pieter Hintjens ph at imatix.com
Thu May 5 19:20:00 CEST 2011


Fabien,

On Thu, May 5, 2011 at 6:48 PM, Pieter Hintjens <ph at imatix.com> wrote:
> Should not be too difficult doing copy/paste of the xreq class. I'll
> give it a shot... hang on a second...

OK, I've made it. :) The socket type name is PATCH, which stands for
"patchboard".

I've added it to the 2.x branch, in the 2.2 repository (since we're
not adding new functionality to 2.1).

You can check it out from the 2.2 repo here:
https://github.com/zeromq/zeromq2-2/tree/patch-socket

There's a test case in tests/test_patch.c.

The PATCH socket type works precisely like a PUB combined with a PULL.
In detail, it uses fair-queuing for input, and distribution for
output.

There is one gotcha, the same as for PUB sockets, namely if you send
messages before the recipients are finished their async connection,
the messages will get lost.

Thus the test case stupidly does a sleep (1), I'm sure you can find
better ways to synchronize.

Let me know how it works, and we can try to get this into the libzmq 3.0 master.

-Pieter



More information about the zeromq-dev mailing list