Skip to content

Commit

Permalink
Allow to use SSL connection as lazy (#893)
Browse files Browse the repository at this point in the history
* added AMQPLazySSLConnection

Allows to have lazy ssl connection

* dropped deprecated method
  • Loading branch information
odombrovskyi-dev committed Feb 26, 2021
1 parent e9dbc8e commit c9d1038
Showing 1 changed file with 38 additions and 0 deletions.
38 changes: 38 additions & 0 deletions PhpAmqpLib/Connection/AMQPLazySSLConnection.php
@@ -0,0 +1,38 @@
<?php

namespace PhpAmqpLib\Connection;

class AMQPLazySSLConnection extends AMQPSSLConnection
{
/**
* {@inheritdoc}
*/
public function channel($channel_id = null)
{
$this->connect();

return parent::channel($channel_id);
}

/**
* @return null|\PhpAmqpLib\Wire\IO\AbstractIO
*/
public function getIO()
{
if (empty($this->io)) {
$this->connect();
}

return $this->io;
}

/**
* Should the connection be attempted during construction?
*
* @return bool
*/
public function connectOnConstruct()
{
return false;
}
}

0 comments on commit c9d1038

Please sign in to comment.