[zeromq-dev] Watermarks & socket types

Pavel Gushcha pavimus at gmail.com
Tue May 25 11:11:03 CEST 2010

2010/5/25 Martin Sustrik <sustrik at 250bpm.com>:
> Pavel,
>> I'm began developing  of my client-server apps when no xrep/xreq
>> sockets was available and ZMQ_HWM/ZMQ_LWM was present, but not
>> implemented. My clients are asyncronous (it can send multiple
>> request(s) at one time, and then wait for all or some from
>> response(s)). When i started developing, the only plausible solution
>> was:
>> 1) using ZMQ_DOWNSTREAM socket to send request to one from servers,
>> and include client ID in request.
>> 2) using ZMQ_PUB on server to send responses to topic with client ID
>> 3) using ZMQ_SUB socket, subscribed to client ID for receive responses
>> As i understand, now zmq has more better solution:
>> 1) using ZMQ_XREQ socket on client for sending multiple requests
>> without waiting a reply.
>> 2) using ZMQ_XREP socket on server.
> If you don't mind requester working in lock-step fashion you can use
> REQ/REP. If you have to have multiple request in the air at the same
> time use XREQ/XREP.

Yes, i want to have multiple requests in the air

>> Currently, now my old solution is not working properly, when i use
>> watermarks. When i use low values for watermarks, some messages that
>> sent to ZMQ_PUB are dropped and not received by ZMQ_SUB. In
>> documentation i didn't found detailed information about how watermarks
>> works for different socket types (for some types messages will be
>> dropped, for other types sending thread will be blocked). Can you get
>> detailed info about this?
> PUB/SUB = drop the message
> otherwise = block the sender

Thanks for the info. I think, this info must be added to manpages...

>> Is there some workaround to prevent message dropping in my old
>> solution when using watermarks, or i must rewrite all this logic to
>> ZMQ_XREQ/ZMQ_XREP sockets?
> No, sorry. The behaviour in case of full queue is defined by messaging
> pattern, i.e. PUB/SUB => drop messages if queue is full.

Thanks for fast reply!

> Martin
> _______________________________________________
> zeromq-dev mailing list
> zeromq-dev at lists.zeromq.org
> http://lists.zeromq.org/mailman/listinfo/zeromq-dev

More information about the zeromq-dev mailing list