sockets - ZeroMQ 设计决策

标签 sockets system distributed zeromq

在 REQ/REP 套接字中,如果套接字向死(断开连接)节点发送请求,则消息不会传递并停留在占用内存的消息队列中。如何清理这些未送达的消息(比方说,队列中超过 1 分钟的消息)?

谢谢!

最佳答案

您可能希望设置可选参数 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).



... 正值将设置消息在队列中阻塞的最大时间。


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

关于sockets - ZeroMQ 设计决策,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3816373/

相关文章:

ios - 在没有 VOIP 的情况下使 iOS 套接字在后台模式下保持事件状态

linux - 程序是否进行系统调用以获取 linux 中环境变量的值?

windows - 如何设置在启动 perfmon 时运行的默认计数器?

lucene - 在SOLR中即时创建新的核心目录

python - 套接字使用随机端口,我需要一个

Java:如何在池中维护 SSLSocket session 以防止对每条消息进行新的握手

c - 求解带状矩阵方程组

erlang - Tsung 分布式客户端负载测试 - 简单的 HTTP 请求

go - 分布式 Go 的框架(如 Erlang OTP)?

python - 如何在此服务器中实现 Websocket 握手?