本文整理汇总了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);
}
}
示例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());
}
示例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;
}
示例4: delete
/**
* @inheritdoc
*/
public function delete(int $flags = Constants::AMQP_NOPARAM)
{
$this->queue->delete($flags);
}
示例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();
示例6: delete
/**
* @inheritdoc
*/
public function delete($flags = null)
{
$this->delegate->delete(self::convertToDelegateFlags($flags));
}
示例7: cleanupResponseQueue
/**
* @param \AMQPQueue $queue
*/
protected function cleanupResponseQueue(\AMQPQueue $queue)
{
$queue->delete();
}
示例8: removeUserQueue
public function removeUserQueue($userid)
{
$q = new \AMQPQueue($this->cnn);
$q->delete($userid);
}