[zeromq-dev] "Broadcast" messages for PUSH-PULL sockets?

Ian Barber ian.barber at gmail.com
Mon Mar 14 16:25:21 CET 2011

On Mon, Mar 14, 2011 at 3:10 PM, Timothy Shead <tshead at sandia.gov> wrote:

> Is there an easier way to "broadcast" a message to every PULL
> socket connected to a PUSH?  Using a separate PUB-SUB connection seems
> equally problematic - I'm assuming that there's no guarantee that a
> published "finished" message would arrive after the last data message in
> the PUSH-PULL connection.

I'm sure Pieter will reply with a reference to one of the chapter 4 patterns
(which I haven't full read through yet!), which I suspect would apply. That
said I have looked at this myself for work distribution, and hit the same
thing where you want to indicate the end of a stream of data. The options I
came with were:

1. Use an LRU type pattern to distribute the work, which gives a definitive
'received' signal, which makes it easy, but is a little ungainly in my mind.

2. Use a separate PUB/SUB based with a timeout on the main data polling, and
a separate check for the end message on a non-blocking call - this works as
long as you can guarantee that the gap between data messages doesn't exceed
the timeout, which is a bit guess work-y. You can add in as many extra
timeouts in different ways as you want, but they collapse to the same basic
guess at max message gap.
3. Have a return channel with some success signals sent. That is pretty
scalable and lighter than LRU, but again means you have a slightly
unpredictable time at the end.

Hope that helps!

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

More information about the zeromq-dev mailing list