[zeromq-dev] meaning of ZMQ_EVENT_CONNECTED
Arnaud Kapp
kapp.arno at gmail.com
Wed Feb 4 00:14:19 CET 2015
Hello,
I believe it's not enough. Well, your tests seem to prove it's not enough.
My guess would be that the socket is indeed connected, but the
subscriptions have not yet been sent (or acknowledged by the
publisher). I may be wrong here, I don't know much
about the ZMTP protocol.
What you could do this (please wait for more experienced ZMQer's to
confirm or not):
Add a router socket on the publisher's side. Connect to this
second with a dealer from the subscriber's side.
Send some kind of PING message from the publisher (like every
second, or w/e suits you).
Connect your subscriber.
When your subscriber receive a PING message, then send an "I AM
READY" message to the router socket, using your dealer socket.
When receiving the "I AM READY" message on the router socket, your
publisher can start sending real message to the subscriber.
This looks a bit daunting. Depending on what you're doing, it might be
preferable to simply add a sleep() before sending the first message on
the publisher.
On Tue, Feb 3, 2015 at 8:35 PM, McMillan, Scott A
<scott.a.mcmillan at intel.com> wrote:
> Hi,
>
> I'm dealing with the pub-sub "slow joiner" problem. As I understand it,
> the problem arises, in part, because connections are asynchronous and
> zmq_connect() returns before the connection is actually established.
>
> I hooked up a monitor and wait until the monitor indicates the socket is
> in the CONNECTED state before publishing. However, even with the socket
> in the CONNECTED state, the first few messages are usually lost.
>
> Does ZMQ_EVENT_CONNECTED actually mean that the connection is fully
> established and ready for pubs? Or something lesser?
>
> Thanks,
> Scott
>
> P.S. Sorry if I'm just re-asking this question:
> http://grokbase.com/t/zeromq/zeromq-dev/151enr4dae/zmq-event-connected-and-
> router-socket. Not sure if pub-sub is sufficiently different than
> router-router change the meaning of ZMQ_EVENT_CONNECTED.
>
> _______________________________________________
> zeromq-dev mailing list
> zeromq-dev at lists.zeromq.org
> http://lists.zeromq.org/mailman/listinfo/zeromq-dev
--
Kapp Arnaud - Xaqq
More information about the zeromq-dev
mailing list