From 5d03bfe4a29d59079d1c36a02c31d60f4a2cc6de Mon Sep 17 00:00:00 2001 From: Derek Chan Date: Mon, 4 Feb 2019 16:04:39 +0800 Subject: [PATCH] supporting amqp-lib's channel_rpc_timeout option --- pkg/amqp-lib/AmqpConnectionFactory.php | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/pkg/amqp-lib/AmqpConnectionFactory.php b/pkg/amqp-lib/AmqpConnectionFactory.php index 169671d12..3cb1c29b7 100644 --- a/pkg/amqp-lib/AmqpConnectionFactory.php +++ b/pkg/amqp-lib/AmqpConnectionFactory.php @@ -47,6 +47,7 @@ public function __construct($config = 'amqp:') ->addDefaultOption('login_response', null) ->addDefaultOption('locale', 'en_US') ->addDefaultOption('keepalive', false) + ->addDefaultOption('channel_rpc_timeout', 0.) ->addDefaultOption('heartbeat_on_tick', true) ->parse() ; @@ -120,7 +121,8 @@ private function establishConnection(): AbstractConnection (int) round(min($this->config->getReadTimeout(), $this->config->getWriteTimeout())), null, $this->config->getOption('keepalive'), - (int) round($this->config->getHeartbeat()) + (int) round($this->config->getHeartbeat()), + $this->config->getOption('channel_rpc_timeout') ); } else { $con = new AMQPStreamConnection( @@ -137,7 +139,8 @@ private function establishConnection(): AbstractConnection (int) round(min($this->config->getReadTimeout(), $this->config->getWriteTimeout())), null, $this->config->getOption('keepalive'), - (int) round($this->config->getHeartbeat()) + (int) round($this->config->getHeartbeat()), + $this->config->getOption('channel_rpc_timeout') ); } } else { @@ -159,7 +162,8 @@ private function establishConnection(): AbstractConnection (int) round($this->config->getReadTimeout()), $this->config->getOption('keepalive'), (int) round($this->config->getWriteTimeout()), - (int) round($this->config->getHeartbeat()) + (int) round($this->config->getHeartbeat()), + $this->config->getOption('channel_rpc_timeout') ); } else { $con = new AMQPSocketConnection( @@ -175,7 +179,8 @@ private function establishConnection(): AbstractConnection (int) round($this->config->getReadTimeout()), $this->config->getOption('keepalive'), (int) round($this->config->getWriteTimeout()), - (int) round($this->config->getHeartbeat()) + (int) round($this->config->getHeartbeat()), + $this->config->getOption('channel_rpc_timeout') ); } }