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


PHP AMQPChannel::queue_delete方法代码示例

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


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

示例1: tearDown

 /**
  * Shut it down, delete exchanges, queues, close connections and channels
  */
 public function tearDown()
 {
     if ($this->ch) {
         $this->ch->exchange_delete($this->exchange);
         $this->ch->queue_delete($this->queue);
         $this->ch->close();
     }
     if ($this->conn) {
         $this->conn->close();
     }
 }
开发者ID:vongrad,项目名称:loanbroker,代码行数:14,代码来源:ReconnectConnectionTest.php

示例2: notifyDispatcher

 /**
  * Signal to the emitter of the message that we finished.
  *
  * @param string $exchange
  * @param string $queue
  * @param string $messageContent Message to send to the dispatcher.
  *
  * @return bool
  */
 protected function notifyDispatcher($exchange, $queue, $messageContent)
 {
     // We put in the queue that we finished
     $this->channel->basic_publish(new AMQPMessage($messageContent), $exchange);
     // Read the first message coming out of the queue
     $message = $this->waitForMessage($queue, 0.5);
     if (!$message) {
         // Shouldn't happen -> error while delivering messages?
         return false;
     }
     // If the first message of the queue is our message, we can die in peace
     // (else it would be the "timeout" message from the dispatcher)
     $dispatcherNotified = $message->body == $messageContent;
     // Delete our queue
     $this->channel->queue_delete($queue);
     return $dispatcherNotified;
 }
开发者ID:bashilbers,项目名称:messaging,代码行数:26,代码来源:Worker.php

示例3: waitForTask

 private function waitForTask($timeout, $exchange, $queue, callable $completed = null, callable $timedout = null, callable $errored = null)
 {
     // Wait X seconds for the task to be finished
     $message = $this->waitForMessage($queue, $timeout);
     // No response from the worker (the task is not finished)
     if (!$message) {
         // We put in the queue that we timed out
         $this->channel->basic_publish(new AMQPMessage('timeout'), $exchange);
         // Read the first message coming out of the queue
         $message = $this->waitForMessage($queue, 0.5);
         if (!$message) {
             // Shouldn't happen -> error while delivering messages?
             return;
         }
     }
     // If the first message of the queue is a "finished" message from the worker
     if ($message->body == 'finished') {
         if ($completed !== null) {
             call_user_func($completed);
         }
         // Delete the temporary exchange
         $this->channel->exchange_delete($exchange);
     }
     // If the first message of the queue is a "errored" message from the worker
     if ($message->body == 'errored') {
         if ($errored !== null) {
             $e = new \RuntimeException("An error occured in the background task");
             call_user_func($errored, $e);
         }
         // Delete the temporary exchange
         $this->channel->exchange_delete($exchange);
     }
     // If the first message of the queue is our "timeout" message
     if ($message->body == 'timeout') {
         if ($timedout !== null) {
             call_user_func($timedout);
         }
         // Do not delete the temp exchange: still used by the worker
     }
     // Delete the temporary queue
     $this->channel->queue_delete($queue);
 }
开发者ID:basuritas-php,项目名称:php-Work,代码行数:42,代码来源:RabbitMQWorkDispatcher.php


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