Creates an AMQPConnection instance representing a connection to an AMQP
broker. A connection will not be established until
AMQPConnection::connect() is called.
$credentials = array(
'host' => amqp.host The host to connect too. Note: Max 1024 characters.
'port' => amqp.port Port on the host.
'vhost' => amqp.vhost The virtual host on the host. Note: Max 128 characters.
'login' => amqp.login The login name to use. Note: Max 128 characters.
'password' => amqp.password Password. Note: Max 128 characters.
'read_timeout' => Timeout in for income activity. Note: 0 or greater seconds. May be fractional.
'write_timeout' => Timeout in for outcome activity. Note: 0 or greater seconds. May be fractional.
'connect_timeout' => Connection timeout. Note: 0 or greater seconds. May be fractional.
Connection tuning options (see http://www.rabbitmq.com/amqp-0-9-1-reference.html#connection.tune for details):
'channel_max' => Specifies highest channel number that the server permits. 0 means standard extension limit
(see PHP_AMQP_MAX_CHANNELS constant)
'frame_max' => The largest frame size that the server proposes for the connection, including frame header
and end-byte. 0 means standard extension limit (depends on librabbimq default frame size limit)
'heartbeat' => The delay, in seconds, of the connection heartbeat that the server wants.
0 means the server does not want a heartbeat. Note, librabbitmq has limited heartbeat support,
which means heartbeats checked only during blocking calls.
TLS support (see https://www.rabbitmq.com/ssl.html for details):
'cacert' => Path to the CA cert file in PEM format..
'cert' => Path to the client certificate in PEM foramt.
'key' => Path to the client key in PEM format.
'verify' => Enable or disable peer verification. If peer verification is enabled then the common name in the
server certificate must match the server name. Peer verification is enabled by default.
)
public __construct ( array $credentials = [] ) | ||
$credentials | array | Optional array of credential information for connecting to the AMQP broker. |
/** * Initialize the lazy connection if not initialized yet */ private function initLazyConnection() { if (is_null($this->io)) { parent::__construct($this->host, $this->port, $this->user, $this->password, $this->vhost, $this->insist, $this->login_method, $this->login_response, $this->locale, $this->connection_timeout, $this->read_write_timeout, $this->context); } }
public function __construct($host, $port, $user, $password, $vhost = "/", $ssl_options = array(), $options = array()) { $ssl_context = empty($ssl_options) ? null : $this->create_ssl_context($ssl_options); parent::__construct($host, $port, $user, $password, $vhost = "/", isset($options['insist']) ? $options['insist'] : false, isset($options['login_method']) ? $options['login_method'] : "AMQPLAIN", isset($options['login_response']) ? $options['login_response'] : null, isset($options['locale']) ? $options['locale'] : "en_US", isset($options['connection_timeout']) ? $options['connection_timeout'] : 3, isset($options['read_write_timeout']) ? $options['read_write_timeout'] : 3, $ssl_context); }
/** * @param array $infos keys must be 'host', 'port', 'login', 'password', 'vhost' */ public function __construct(array $infos) { parent::__construct($infos); }