[zeromq-dev] Important: backward incompatible changes for 0MQ/3.0!
Pieter Hintjens
ph at imatix.com
Sun Apr 3 11:11:34 CEST 2011
2011/4/1 Paul Colomiets <tailhook at yandex.ru>:
> BTW, it's much more important than repeating requests in REQ socket,
> since latter can be easily done in user code. Well, actually it forces
> me to always use XREQ/XREP sockets which points that REQ ones are
> probably useless for any realistic applications. So probably for blocking
> use case we need some option like ZMQ_RESET, to allow to request
> again.
Actually, REQ sockets work surprisingly well in realistic worker-style
req-rep applications, i.e. with stateless idempotent workers. We
explored this in Ch4 of the Guide. You need to poll, and if there's no
response within your timeout, close the socket, reopen, and resend the
request. The effect of this is that downstream ROUTER devices will
automatically discard duplicate replies. The client doesn't get
duplicate replies, even if it sends the request multiple times. It
doesn't work if the client sets an explicit identity, but that's
usually a bad idea for clients, anyhow.
It was a nice surprise to see how useful REQ is in these cases.
-Pieter
More information about the zeromq-dev
mailing list