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


PHP AMQPQueue::delete方法代码示例

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


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

示例1: delete

 /**
  * @param int $flags
  *
  * @return int
  */
 public function delete($flags = Client::NOPARAM)
 {
     try {
         return $this->rawQueue->delete($flags);
     } catch (\Exception $e) {
         ClientHelper::throwRightException($e);
     }
 }
开发者ID:csharpru,项目名称:yii2-amqp,代码行数:13,代码来源:Queue.php

示例2: GetMessageBody

 /**
  * Return result of task execution for $task_id
  * @param AMQPConnection $connection Connection object
  * @param string $task_id Celery task identifier
  * @param boolean $removeMessageFromQueue whether to remove message from queue
  * @return array array('body' => JSON-encoded message body, 'complete_result' => AMQPEnvelope object)
  * 			or false if result not ready yet
  */
 function GetMessageBody($connection, $task_id, $removeMessageFromQueue = true)
 {
     $this->Connect($connection);
     $ch = $connection->channel;
     $q = new AMQPQueue($ch);
     $q->setName($task_id);
     $q->setFlags(AMQP_AUTODELETE | AMQP_DURABLE);
     $q->declareQueue();
     try {
         $q->bind('celeryresults', $task_id);
     } catch (AMQPQueueException $e) {
         if ($removeMessageFromQueue) {
             $q->delete();
         }
         $connection->disconnect();
         return false;
     }
     $message = $q->get(AMQP_AUTOACK);
     if (!$message) {
         if ($removeMessageFromQueue) {
             $q->delete();
         }
         $connection->disconnect();
         return false;
     }
     if ($message->getContentType() != 'application/json') {
         if ($removeMessageFromQueue) {
             $q->delete();
         }
         $connection->disconnect();
         throw new CeleryException('Response was not encoded using JSON - found ' . $message->getContentType() . ' - check your CELERY_RESULT_SERIALIZER setting!');
     }
     if ($removeMessageFromQueue) {
         $q->delete();
     }
     $connection->disconnect();
     return array('complete_result' => $message, 'body' => $message->getBody());
 }
开发者ID:UGuarder,项目名称:celery-php,代码行数:46,代码来源:amqppeclconnector.php

示例3: getCompleteResult

 /**
  * Connect to queue, see if there's a result waiting for us
  * Private - to be used internally
  */
 private function getCompleteResult()
 {
     if ($this->complete_result) {
         return $this->complete_result;
     }
     $this->connection->connect();
     $ch = new AMQPChannel($this->connection);
     $q = new AMQPQueue($ch);
     $q->setName($this->task_id);
     $q->setFlags(AMQP_AUTODELETE);
     #		$q->setArgument('x-expires', 86400000);
     $q->declareQueue();
     try {
         $q->bind('celeryresults', $this->task_id);
     } catch (AMQPQueueException $e) {
         $q->delete();
         $this->connection->disconnect();
         return false;
     }
     $message = $q->get(AMQP_AUTOACK);
     if (!$message) {
         $q->delete();
         $this->connection->disconnect();
         return false;
     }
     $this->complete_result = $message;
     if ($message->getContentType() != 'application/json') {
         $q->delete();
         $this->connection->disconnect();
         throw new CeleryException('Response was not encoded using JSON - found ' . $message->getContentType() . ' - check your CELERY_RESULT_SERIALIZER setting!');
     }
     $this->body = json_decode($message->getBody());
     $q->delete();
     $this->connection->disconnect();
     return false;
 }
开发者ID:NaszvadiG,项目名称:cim-xa,代码行数:40,代码来源:asyncresult.php

示例4: delete

 /**
  * @inheritdoc
  */
 public function delete(int $flags = Constants::AMQP_NOPARAM)
 {
     $this->queue->delete($flags);
 }
开发者ID:prolic,项目名称:HumusAmqp,代码行数:7,代码来源:Queue.php

示例5: microtime

}
$timer = microtime(true) - $timer;
echo '    Get: ', $iterations, ' iterations took ', $timer, 'sec', PHP_EOL;
$q->delete();
$exchange->delete();
echo PHP_EOL;
// ==================================
$exchange = new AMQPExchange($ch);
$exchange->setType(AMQP_EX_TYPE_FANOUT);
$exchange->setFlags(AMQP_AUTODELETE);
$exchange->setName('benchmark_exchange_' . microtime(true));
$exchange->declareExchange();
$q = new AMQPQueue($ch);
$q->setFlags(AMQP_AUTODELETE);
$q->declareQueue();
$q->bind($exchange->getName());
$timer = microtime(true);
for ($i = 0; $i < $iterations; $i++) {
    $exchange->publish($message);
}
$timer = microtime(true) - $timer;
echo 'Publish: ', $iterations, ' iterations took ', $timer, 'sec', PHP_EOL;
$consumer_iterations = $iterations;
$timer = microtime(true);
$q->consume(function () use(&$consumer_iterations) {
    return --$consumer_iterations > 0;
}, AMQP_AUTOACK);
$timer = microtime(true) - $timer;
echo 'Consume: ', $iterations, ' iterations took ', $timer, 'sec', PHP_EOL;
$q->delete();
$exchange->delete();
开发者ID:vstepanyuk,项目名称:php-amqp,代码行数:31,代码来源:benchmark.php

示例6: delete

 /**
  * @inheritdoc
  */
 public function delete($flags = null)
 {
     $this->delegate->delete(self::convertToDelegateFlags($flags));
 }
开发者ID:treehouselabs,项目名称:queue,代码行数:7,代码来源:Queue.php

示例7: cleanupResponseQueue

 /**
  * @param \AMQPQueue $queue
  */
 protected function cleanupResponseQueue(\AMQPQueue $queue)
 {
     $queue->delete();
 }
开发者ID:boekkooi,项目名称:tactician-amqp,代码行数:7,代码来源:CommandPublisher.php

示例8: removeUserQueue

 public function removeUserQueue($userid)
 {
     $q = new \AMQPQueue($this->cnn);
     $q->delete($userid);
 }
开发者ID:JasonOcean,项目名称:iOS_Interest_Group,代码行数:5,代码来源:AMQPChannel.php


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