- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我的集群中有 2 个rabbitmq,由 Azure 内部负载均衡器进行负载均衡。客户端通过 BlockingConnection
连接到负载均衡器。
当客户端交换消息时,一切正常。但是,当没有事件时,我的客户端似乎已断开连接,并且无法再接收消息。
我想知道这个问题有没有解决办法?我假设负载均衡器或rabbitmq 由于不活动而关闭连接。我想让pika向rabbitmq触发一些心跳(以便负载均衡器保持连接打开)但没有找到任何好的解决方案。你能给点建议吗?
编辑 1看来 pika BlockingConnections 不支持心跳。 Heart beat disables blocking connection
谢谢。
最佳答案
根据 Pika 文档 http://pika.readthedocs.org/en/0.10.0/modules/parameters.html ,看来 Pika 阻止了与 URLParameters
的联系指定heart_interval
(如amqps://www-data:rabbit_pwd@rabbit1/web_messages?heartbeat_interval=30
)可以保持连接打开,但heart_interval的值不能大于rabbit服务器建议的值。
The heartbeat timeout value defines after what period of time the peer TCP connection should be considered dead by RabbitMQ and client libraries. This value is negotiated between the client and RabbitMQ server at the time of connection. The client must be configured to request heartbeats. In RabbitMQ versions 3.0 and higher, the broker will attempt to negotiate heartbeats by default (although the client can still veto them). The timeout is in seconds, and default value is 60 (580 prior to release 3.5.5).
Heartbeat frames are sent about every timeout / 2 seconds. After two missed heartbeats, the peer is considered to be unreachable. Different clients manifest this differently but the TCP connection will be closed. When a client detects that RabbitMQ node is unreachable due to a heartbeat, it needs to re-connect.
Heartbeats can be disabled by setting the timeout interval to 0.
来自 Pika 文档的示例代码:
import pika
parameters = pika.URLParameters('amqps://www-data:rabbit_pwd@rabbit1/web_messages?heartbeat_interval=30')
connection = pika.BlockingConnection(parameters)
关于python - Pika BlockingConnection 和 RabbitMQ : connection closed,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34721178/
我正在尝试在容器内使用Rabbitmq。我安装了必需的库,然后尝试创建BlockingConnection,但是失败。当我在任何VM或物理主机上尝试时,同样的事情也起作用。它仅对容器失败。步骤如下:-
我正在尝试开发一个 Android Wear 应用程序并从移动助手 Activity 中传递一个 Assets 。我已经按照官方文件传递 Assets - Transferring Assets ,但
我对 BlockingConnection 和 AsyncoreConnection 有点困惑。我想从 Django 应用程序向 RabbitMQ 队列发送一些消息。使用全局 BlockingConn
我的集群中有 2 个rabbitmq,由 Azure 内部负载均衡器进行负载均衡。客户端通过 BlockingConnection 连接到负载均衡器。 当客户端交换消息时,一切正常。但是,当没有事件时
我的集群中有 2 个rabbitmq,由 Azure 内部负载均衡器进行负载均衡。客户端通过 BlockingConnection 连接到负载均衡器。 当客户端交换消息时,一切正常。但是,当没有事件时
为什么 GoogleApiClient 的 blockingConnect 方法返回 ConnectionResult.CANCELED 而在同一调用期间我从 OnConnectionFailedLi
我是一名优秀的程序员,十分优秀!