[zeromq-dev] Check if message is dropped due to HWM at send in ZeroMQ PUB-SUB pattern

Ranganath Gunawardane ranganath at outlook.com
Tue Sep 30 01:36:43 CEST 2014

Hi All, I have implemented a message router using zmq, czmq with pub-sub pattern. 
In my simple test set up, I am using a publisher-subscriber with a proxy. I have a fast sender and a very slow receiver causing messages to hit HWM and drop on send. My exception is that send would fail with 'message dropped' error, but it is not the case. the zmq_msg_send() is not giving me any error even though the messages get dropped (I can verify this by seeing gaps in messages in subscriber end). 
I have looked into fixing slow subscriber problem by adding a sequence number as you suggested, specially suicidal snail pattern in the guide. But my use case is a bit different. I really do not care about the subscribers; I want to let my publisher know if he is dropping messages because he has hit the HWM.
I gather that this is the nature of pub-sub. At the same time, from documentation, it says, if I use ZMQ_DONTWAIT, and 'if the message cannot be queued on the socket, function call shall fail'. Does it mean that I can use this failure as a 'send failure due to buffer full'? 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.zeromq.org/pipermail/zeromq-dev/attachments/20140930/577c79fe/attachment.htm>

More information about the zeromq-dev mailing list