首页 > 解决方案 > 节点使用 VIP 的 php-amqplib heatbeat 问题

问题描述

当rabbitmq服务器节点使用VIP并漂移时,客户端进程将保持并且没有心跳:

while (count($this->channel->callbacks)) {
    $this->channel->wait();
}

当 VIP 漂移时,客户端会打开AbstractConnection::wait_channel()

list($frame_type, $frame_channel, $payload) = $this->wait_frame($_timeout);

因为$_timeout default set 0

标签: phprabbitmq

解决方案


该过程在 StreamIO.php select() 上进行:

$result = stream_select($read, $write, $except, $sec, $usec);

我们可以通过定义环境变量来避免它

define('AMQP_WITHOUT_SIGNALS', true);

推荐阅读