[zeromq-dev] pub/sub env example not working...

Pieter Hintjens ph at imatix.com
Sun Jun 5 22:29:34 CEST 2011


On Sun, Jun 5, 2011 at 1:11 PM, Sean Ochoa <sean.m.ochoa at gmail.com> wrote:

> @Chuck:  Thanks!!!! That did the trick.  I wonder if you could help me
> understand why I need to wait for a bit for it to kick into gear?  I'm sure
> I missed it while reading through the guide.

There is a "problem solver" at the end of Ch1 that explains this.

Some socket types (ROUTER and PUB) will silently drop messages for
which they have no recipients. Connecting is, as Chuck said,
asynchronous and takes approx 100msec. If you start two threads, bind
one side, connect the other, and then start immediately to send data
over such a socket type, you'll lose the first 100msec of data
(approximately).

Doing a sleep is a brutal "prove that it works" option. Realistically
you'd synchronize in some way, or (more typically) expect message loss
as part of normal startup (i.e. see the published data as a pure
broadcast with no definite start or end).

See weather update example, syncpub and syncsub for details.

-Pieter



More information about the zeromq-dev mailing list