[zeromq-dev] ROUTER/PULL
Justin Karneges
justin at affinix.com
Wed Nov 14 04:13:34 CET 2012
On Wednesday, November 14, 2012 11:15:09 AM Pieter Hintjens wrote:
> You've not identified any problem with using DEALER except "it's not
> PULL", which seems arbitrary. You can literally replace ZMQ_PULL with
> ZMQ_DEALER in your code and it will work the same.
Ah, okay, I did not think of this. Currently my receiving socket uses ROUTER
and ignores the header, but I like the idea of using DEALER instead as that
aligns slightly closer to the intended usage (read: of not really caring about
envelopes or return addresses). Note that I never was using PULL in this
context, I only wanted to start a discussion about the possibility.
Anyway, the only real difference between DEALER and PULL then is that, at a
glance, the PULL socket has a more obvious contract. This may help when
familiarizing oneself to a zmq-based project, or for a network administrator
that is configuring socket connections. But this is just a nitpick.
> How do you know the identity of the PULL socket you're sending to? The
> ROUTER socket does not work well with purely outbound communications.
> There are several aspects:
>
> * You need to invent and manage your own identities
> * You have no way of knowing when the connection is actually live
> * When sending, and connection is not live, messages are silently dropped
> * You have no way to heartbeat the connection, so cannot detect failures
Of course there is some extra work when doing this. In my case, the use of
credits-based flow control and timeouts (in both directions, but on separate
sockets) ensures that failures are noticed.
Justin
More information about the zeromq-dev
mailing list