rabbitmq链接超时_如何在RabbitMQ服务器上设置超时检测?

RabbitMQ在客户机确认消息已被处理时没有超时:请参阅this post(整个线程可能会引起兴趣)。帖子中的一些要点:The AMQP ack model for subscriptions

and "pull" are identical. In both

cases the message is kept on the

server but is unavailable to other

consumers until it either has been

ack'ed (and gets removed), nack'ed

(with basic.reject; though RabbitMQ

does not implement that) or the

channel/connection is closed (at which

point the message becomes available

to other consumers).

(我的重点)There is no timeout on waiting for

acks. Usually that is not a problem

since the common cases of a missing

ack - network or client failure -

will result in the connection getting

dropped (and thus trigger the

behaviour described above). Still,

a timeout could be useful to, say,

deal with alive but unresponsive

consumers. That has come up in

discussion before. Is there a specific

use case you have in mind that

requires such functionality?

这个问题很可能发生,因为在客户机拉取模型中,服务器很难检测到断开的连接(而不是活动但无响应的消费者),特别是服务器似乎乐于永远等待ack。

更新:在Linux上,您可以附加SIGTERM和/或SIGKILL和/或SIGINT的信号处理程序,并希望以有序的方式从客户端关闭连接。在Windows上,我相信从任务管理器关闭会调用Win32TerminateProcessAPI,MSDN对此说:If a process is terminated by

TerminateProcess, all threads of the

process are terminated immediately

with no chance to run additional code.

This means that the thread does not

execute code in termination handler

blocks. In addition, no attached DLLs

are notified that the process is

detaching.

这意味着可能很难有秩序地终止和关闭。

可能值得在RabbitMQ列表中使用您自己的ack超时用例。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值