当前位置: 首页>>代码示例>>PHP>>正文


PHP AMQPStreamConnection::reconnect方法代码示例

本文整理汇总了PHP中PhpAmqpLib\Connection\AMQPStreamConnection::reconnect方法的典型用法代码示例。如果您正苦于以下问题:PHP AMQPStreamConnection::reconnect方法的具体用法?PHP AMQPStreamConnection::reconnect怎么用?PHP AMQPStreamConnection::reconnect使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PhpAmqpLib\Connection\AMQPStreamConnection的用法示例。


在下文中一共展示了AMQPStreamConnection::reconnect方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: reconnect

 /**
  * Reconnect amqp connection
  */
 public function reconnect()
 {
     if (!$this->amqpConnection->isConnected()) {
         $this->amqpConnection->reconnect();
         $this->channel = $this->amqpConnection->channel();
         $this->declaredQueues = [];
     }
 }
开发者ID:ysaroka,项目名称:uploader,代码行数:11,代码来源:AmqpWrapper.php

示例2: pop

 /**
  * {@inheritdoc}
  */
 public function pop(string $queue = null)
 {
     $queue = $this->getQueue($queue);
     try {
         $this->declareQueue($queue);
     } catch (AMQPRuntimeException $exception) {
         $this->connection->reconnect();
         $this->declareQueue($queue);
     }
     // get envelope
     $message = $this->channel->basic_get($queue);
     if ($message instanceof AMQPMessage) {
         return new RabbitMQJob($this->container, $this, $this->channel, $queue, $message);
     }
 }
开发者ID:narrowspark,项目名称:framework,代码行数:18,代码来源:RabbitMQQueue.php

示例3: 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);
 }
开发者ID:retrinko,项目名称:cottontail,代码行数:24,代码来源:PhpAmqpLibConnector.php


注:本文中的PhpAmqpLib\Connection\AMQPStreamConnection::reconnect方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。