Skip to content

Commit 41823f7

Browse files
committed
supporting amqp-lib's channel_rpc_timeout option
1 parent cc9d276 commit 41823f7

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

AmqpConnectionFactory.php

+9-4
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ public function __construct($config = 'amqp:')
4747
->addDefaultOption('login_response', null)
4848
->addDefaultOption('locale', 'en_US')
4949
->addDefaultOption('keepalive', false)
50+
->addDefaultOption('channel_rpc_timeout', 0.)
5051
->addDefaultOption('heartbeat_on_tick', true)
5152
->parse()
5253
;
@@ -120,7 +121,8 @@ private function establishConnection(): AbstractConnection
120121
(int) round(min($this->config->getReadTimeout(), $this->config->getWriteTimeout())),
121122
null,
122123
$this->config->getOption('keepalive'),
123-
(int) round($this->config->getHeartbeat())
124+
(int) round($this->config->getHeartbeat()),
125+
$this->config->getOption('channel_rpc_timeout')
124126
);
125127
} else {
126128
$con = new AMQPStreamConnection(
@@ -137,7 +139,8 @@ private function establishConnection(): AbstractConnection
137139
(int) round(min($this->config->getReadTimeout(), $this->config->getWriteTimeout())),
138140
null,
139141
$this->config->getOption('keepalive'),
140-
(int) round($this->config->getHeartbeat())
142+
(int) round($this->config->getHeartbeat()),
143+
$this->config->getOption('channel_rpc_timeout')
141144
);
142145
}
143146
} else {
@@ -159,7 +162,8 @@ private function establishConnection(): AbstractConnection
159162
(int) round($this->config->getReadTimeout()),
160163
$this->config->getOption('keepalive'),
161164
(int) round($this->config->getWriteTimeout()),
162-
(int) round($this->config->getHeartbeat())
165+
(int) round($this->config->getHeartbeat()),
166+
$this->config->getOption('channel_rpc_timeout')
163167
);
164168
} else {
165169
$con = new AMQPSocketConnection(
@@ -175,7 +179,8 @@ private function establishConnection(): AbstractConnection
175179
(int) round($this->config->getReadTimeout()),
176180
$this->config->getOption('keepalive'),
177181
(int) round($this->config->getWriteTimeout()),
178-
(int) round($this->config->getHeartbeat())
182+
(int) round($this->config->getHeartbeat()),
183+
$this->config->getOption('channel_rpc_timeout')
179184
);
180185
}
181186
}

0 commit comments

Comments
 (0)