Skip to content

Commit 4fa8c74

Browse files
committed
amqp: allow to configure heartbeats
1 parent cce215b commit 4fa8c74

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/Queue/Broker/AMQP.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,8 @@ public function __construct(
3838
private readonly int $httpPort = 15672,
3939
private readonly ?string $user = null,
4040
private readonly ?string $password = null,
41-
private readonly string $vhost = '/'
41+
private readonly string $vhost = '/',
42+
private readonly int $heartbeat = 0,
4243
) {
4344
}
4445

@@ -177,7 +178,7 @@ public function getQueueSize(Queue $queue, bool $failedJobs = false): int
177178
private function withChannel(callable $callback): void
178179
{
179180
$createChannel = function (): AMQPChannel {
180-
$connection = new AMQPStreamConnection($this->host, $this->port, $this->user, $this->password, $this->vhost);
181+
$connection = new AMQPStreamConnection($this->host, $this->port, $this->user, $this->password, $this->vhost, heartbeat: $this->heartbeat);
181182
if (is_callable($this->connectionConfigHook)) {
182183
call_user_func($this->connectionConfigHook, $connection);
183184
}

0 commit comments

Comments
 (0)