ZeroMQ design decisions

In a REQ/REP socket, if the socket send a request to a dead (disconnected) node the message isn't delivered and stays in a message queue occupying memory. How can one clean these undelivered messages (let's say, messages that are in the queue for more than 1 minute)?

Thanks!


You might want to set the optional parameter ZMQ_LINGER :

The ZMQ_LINGER option shall set the linger period for the specified socket. The linger period determines how long pending messages which have yet to be sent to a peer shall linger in memory after a socket is closed with zmq_close(3), and further affects the termination of the socket's context with zmq_term(3).

... for which a positive value will set a maximun time for message to be blocked in the queue.

See http://api.zeromq.org/2-1-1:zmq-setsockopt

链接地址: http://www.djcxy.com/p/3024.html

上一篇: Android 2.2.1更新日志

下一篇: ZeroMQ设计决策