Skip to content

Commit 5665709

Browse files
committed
Added config options: heartbeat, timeout
1 parent 8c18fa0 commit 5665709

File tree

3 files changed

+15
-13
lines changed

3 files changed

+15
-13
lines changed

src/Connection/Connection.php

+10-12
Original file line numberDiff line numberDiff line change
@@ -26,20 +26,18 @@ public function __construct(
2626
int $port,
2727
string $user,
2828
string $password,
29-
string $vhost
29+
string $vhost,
30+
float $heartbeat,
31+
float $timeout
3032
) {
31-
$this->host = $host;
32-
$this->port = $port;
33-
$this->user = $user;
34-
$this->password = $password;
35-
$this->vhost = $vhost;
36-
3733
$this->bunnyClient = new Bunny\Client([
38-
'host' => $this->host,
39-
'port' => $this->port,
40-
'user' => $this->user,
41-
'password' => $this->password,
42-
'vhost' => $this->vhost,
34+
'host' => $host,
35+
'port' => $port,
36+
'user' => $user,
37+
'password' => $password,
38+
'vhost' => $vhost,
39+
'heartbeat' => $heartbeat,
40+
'timeout' => $timeout,
4341
]);
4442

4543
$this->bunnyClient->connect();

src/Connection/ConnectionFactory.php

+3-1
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,9 @@ private function create(string $name): Connection
6868
(int) $connectionData['port'],
6969
$connectionData['user'],
7070
$connectionData['password'],
71-
$connectionData['vhost']
71+
$connectionData['vhost'],
72+
$connectionData['heartbeat'],
73+
$connectionData['timeout']
7274
);
7375
}
7476

src/DI/Helpers/ConnectionsHelper.php

+2
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ final class ConnectionsHelper extends AbstractHelper
2727
'user' => 'guest',
2828
'password' => 'guest',
2929
'vhost' => '/',
30+
'timeout' => 1,
31+
'heartbeat' => 60.0,
3032
];
3133

3234

0 commit comments

Comments
 (0)