Skip to content

Commit ba92616

Browse files
committed
amqp-bunny: Add SSL support
1 parent 867d45f commit ba92616

File tree

1 file changed

+14
-4
lines changed

1 file changed

+14
-4
lines changed

pkg/amqp-bunny/AmqpConnectionFactory.php

+14-4
Original file line numberDiff line numberDiff line change
@@ -74,10 +74,6 @@ public function getConfig(): ConnectionConfig
7474

7575
private function establishConnection(): BunnyClient
7676
{
77-
if ($this->config->isSslOn()) {
78-
throw new \LogicException('The bunny library does not support SSL connections');
79-
}
80-
8177
if (false == $this->client) {
8278
$bunnyConfig = [];
8379
$bunnyConfig['host'] = $this->config->getHost();
@@ -102,6 +98,20 @@ private function establishConnection(): BunnyClient
10298
$bunnyConfig['tcp_nodelay'] = $this->config->getOption('tcp_nodelay');
10399
}
104100

101+
if ($this->config->isSslOn()) {
102+
$sslOptions = array_filter([
103+
'cafile' => $this->config->getSslCaCert(),
104+
'local_cert' => $this->config->getSslCert(),
105+
'local_pk' => $this->config->getSslKey(),
106+
'verify_peer' => $this->config->isSslVerify(),
107+
'verify_peer_name' => $this->config->isSslVerify(),
108+
'passphrase' => $this->getConfig()->getSslPassPhrase(),
109+
'ciphers' => $this->config->getOption('ciphers', ''),
110+
], function ($value) { return '' !== $value; });
111+
112+
$bunnyConfig['ssl'] = $sslOptions;
113+
}
114+
105115
$this->client = new BunnyClient($bunnyConfig);
106116
$this->client->connect();
107117
}

0 commit comments

Comments
 (0)