本文整理汇总了PHP中PhpAmqpLib\Connection\AMQPStreamConnection::isConnected方法的典型用法代码示例。如果您正苦于以下问题:PHP AMQPStreamConnection::isConnected方法的具体用法?PHP AMQPStreamConnection::isConnected怎么用?PHP AMQPStreamConnection::isConnected使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PhpAmqpLib\Connection\AMQPStreamConnection
的用法示例。
在下文中一共展示了AMQPStreamConnection::isConnected方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: reconnect
/**
* Reconnect amqp connection
*/
public function reconnect()
{
if (!$this->amqpConnection->isConnected()) {
$this->amqpConnection->reconnect();
$this->channel = $this->amqpConnection->channel();
$this->declaredQueues = [];
}
}
示例2: connect
/**
* @param bool $forceReconnection
*
* @return void
*/
public function connect($forceReconnection = false)
{
$useSslConnection = !empty($this->sslOptions);
$env = ['server' => $this->server, 'port' => $this->port, 'vhost' => $this->vhost, 'ssl' => $useSslConnection];
if (true == $forceReconnection || false == $this->connection instanceof AMQPStreamConnection) {
$this->logger->debug('Stablishing connection...', $env);
if ($useSslConnection) {
$this->connection = new AMQPSSLConnection($this->server, $this->port, $this->user, $this->pass, $this->vhost, $this->sslOptions);
} else {
$this->connection = new AMQPStreamConnection($this->server, $this->port, $this->user, $this->pass, $this->vhost);
}
$this->logger->info('Connection stablished!', $env);
} elseif (false == $this->connection->isConnected()) {
$this->logger->debug('Restablishing connection...', $env);
$this->connection->reconnect();
$this->logger->info('Connection restablished!', $env);
}
$this->openChannel($forceReconnection);
}
示例3: isConnected
public function isConnected()
{
return $this->connection->isConnected();
}