gpt4 book ai didi

rabbitmq - rabbitmq 心跳是如何工作的

转载 作者:行者123 更新时间:2023-12-04 01:03:47 29 4
gpt4 key购买 nike

java的 native rabbitmq客户端允许在连接设置上设置心跳,例如:

import com.rabbitmq.client.ConnectionFactory;

...

ConnectionFactory connectionFactory = new ConnectionFactory();
connectionFactory.setAutomaticRecoveryEnabled(true);
connectionFactory.setHost("some://host");
connectionFactory.setConnectionTimeout(5000);
connectionFactory.setRequestedHeartbeat(5); // keeps an idle connection alive

rabbitmq 客户端对心跳设置做了什么?
它是向特殊交换/队列发送 stub 消息还是其他什么?

有人可以详细解释一下吗?

最佳答案

来自 RMQ Heartbeat documentation :

Network can fail in many ways, sometimes pretty subtle (e.g. high ratio packet loss). Disrupted TCP connections take a moderately long time (about 11 minutes with default configuration on Linux, for example) to be detected by the operating system. AMQP 0-9-1 offers a heartbeat feature to ensure that the application layer promptly finds out about disrupted connections (and also completely unresponsive peers). Heartbeats also defend against certain network equipment which may terminate "idle" TCP connections.



这不是对队列或 stub 消息的请求。这是一个 TCP/IP 连接,数据包以特定的心跳格式发送。

如果你想要真实的细节,你可以阅读 AMQP 0.9.1 Specification ,第 4.2.1 和 4.2.7 节以及 how RabbitMQ corrects for errors in the specification 上的勘误表,同样。

关于rabbitmq - rabbitmq 心跳是如何工作的,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33632567/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com