|
10 | 10 | use PhpAmqpLib\Connection\AMQPLazyConnection; |
11 | 11 | use PhpAmqpLib\Connection\AMQPLazySocketConnection; |
12 | 12 | use PhpAmqpLib\Connection\AMQPSocketConnection; |
| 13 | +use PhpAmqpLib\Connection\AMQPSSLConnection; |
13 | 14 | use PhpAmqpLib\Connection\AMQPStreamConnection; |
14 | 15 |
|
15 | 16 | class AmqpConnectionFactory implements InteropAmqpConnectionFactory, DelayStrategyAware |
@@ -84,7 +85,32 @@ private function establishConnection() |
84 | 85 | { |
85 | 86 | if (false == $this->connection) { |
86 | 87 | if ($this->config->getOption('stream')) { |
87 | | - if ($this->config->isLazy()) { |
| 88 | + if ($this->config->isSslOn()) { |
| 89 | + $con = new AMQPSSLConnection( |
| 90 | + $this->config->getHost(), |
| 91 | + $this->config->getPort(), |
| 92 | + $this->config->getUser(), |
| 93 | + $this->config->getPass(), |
| 94 | + $this->config->getVHost(), |
| 95 | + [ |
| 96 | + 'cafile' => $this->config->getSslCaCert(), |
| 97 | + 'local_cert' => $this->config->getSslCert(), |
| 98 | + 'local_pk' => $this->config->getSslKey(), |
| 99 | + 'verify_peer' => $this->config->isSslVerify(), |
| 100 | + 'verify_peer_name' => $this->config->isSslVerify(), |
| 101 | + ], |
| 102 | + [ |
| 103 | + 'insist' => $this->config->getOption('insist'), |
| 104 | + 'login_method' => $this->config->getOption('login_method'), |
| 105 | + 'login_response' => $this->config->getOption('login_response'), |
| 106 | + 'locale' => $this->config->getOption('locale'), |
| 107 | + 'connection_timeout' => $this->config->getConnectionTimeout(), |
| 108 | + 'read_write_timeout' => (int) round(min($this->config->getReadTimeout(), $this->config->getWriteTimeout())), |
| 109 | + 'keepalive' => $this->config->getOption('keepalive'), |
| 110 | + 'heartbeat' => (int) round($this->config->getHeartbeat()), |
| 111 | + ] |
| 112 | + ); |
| 113 | + } elseif ($this->config->isLazy()) { |
88 | 114 | $con = new AMQPLazyConnection( |
89 | 115 | $this->config->getHost(), |
90 | 116 | $this->config->getPort(), |
@@ -120,6 +146,10 @@ private function establishConnection() |
120 | 146 | ); |
121 | 147 | } |
122 | 148 | } else { |
| 149 | + if ($this->config->isSslOn()) { |
| 150 | + throw new \LogicException('The socket connection implementation does not support ssl connections.'); |
| 151 | + } |
| 152 | + |
123 | 153 | if ($this->config->isLazy()) { |
124 | 154 | $con = new AMQPLazySocketConnection( |
125 | 155 | $this->config->getHost(), |
|
0 commit comments