Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions src/Remote/AMQP/Connector.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@
use InvalidArgumentException;
use PhpAmqpLib\Channel\AMQPChannel;
use PhpAmqpLib\Connection\AMQPStreamConnection;
use PhpAmqpLib\Connection\Heartbeat\PCNTLHeartbeatSender;
use PhpAmqpLib\Connection\Heartbeat;

class Connector
{
private ?AMQPChannel $channel = null;
private ?PCNTLHeartbeatSender $heartbeats = null;
private ?Heartbeat\AbstractSignalHeartbeatSender $heartbeats = null;

/**
* @param array<array<mixed>> $hosts
Expand Down Expand Up @@ -63,7 +63,11 @@ public function connect(): AMQPChannel
$connection = AMQPStreamConnection::create_connection($this->hosts, $this->options);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

А оно не ругнется на неизвестную опцию?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

не ругается


if ($connection->getHeartbeat() > 0) {
$this->heartbeats = new PCNTLHeartbeatSender($connection);
$this->heartbeats = match ($this->options['heartbeat_sender'] ?? null) {
'sig' => new Heartbeat\SIGHeartbeatSender($connection),
default => new Heartbeat\PCNTLHeartbeatSender($connection),
};

$this->heartbeats->register();
}

Expand Down