[zeromq-dev] Custom HWM behavior

Ian Barber ian.barber at gmail.com
Fri Aug 19 19:08:10 CEST 2011

On Fri, Aug 19, 2011 at 5:21 PM, Bernt Habermeier <bernie at fliptrack.com>wrote:

> To be clear, the option I would want is to be able to set a socket option
> (or something like that) that indicates:
>    - If we hit HWM condition, drop data
>    - If we have data at process exit, drop data.
> Alternatively, if I can query the queue length of messages that are unsent
> from the API, instead of blindly adding the event to be sent over the
> socket, I could drop it before it ever hits ZMQ.  Does this exist?  Of
> course, I'd still have to have the ability to "drain the data" to be sent
> out at process exit -- I don't want the process to hang / wait indefinitely.
I think you have the tools you need in the API - look at the ZMQ_LINGER
sockopt for termination, and for sending data you can either use send with
the flag ZMQ_NOBLOCK to guarantee no blocking, or poll the socket first to
see whether a message would block on send.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.zeromq.org/pipermail/zeromq-dev/attachments/20110819/cab6d490/attachment.htm>

More information about the zeromq-dev mailing list