本文整理汇总了PHP中AMQPQueue::cancel方法的典型用法代码示例。如果您正苦于以下问题:PHP AMQPQueue::cancel方法的具体用法?PHP AMQPQueue::cancel怎么用?PHP AMQPQueue::cancel使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AMQPQueue
的用法示例。
在下文中一共展示了AMQPQueue::cancel方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: cancel
/**
* @param string $consumerTag
*
* @return bool
*/
public function cancel($consumerTag = '')
{
try {
return $this->rawQueue->cancel($consumerTag);
} catch (\Exception $e) {
ClientHelper::throwRightException($e);
}
}
示例2: AMQPChannel
$connection->setHost('127.0.0.1');
$connection->setLogin('guest');
$connection->setPassword('guest');
$connection->connect();
//Create and declare channel
$channel = new AMQPChannel($connection);
//AMQPC Exchange is the publishing mechanism
$exchange = new AMQPExchange($channel);
$callback_func = function (AMQPEnvelope $message, AMQPQueue $q) use(&$max_consume) {
echo PHP_EOL, "------------", PHP_EOL;
echo " [x] Received ", $message->getBody(), PHP_EOL;
echo PHP_EOL, "------------", PHP_EOL;
$q->nack($message->getDeliveryTag());
sleep(1);
};
try {
$routing_key = 'hello';
$queue = new AMQPQueue($channel);
$queue->setName($routing_key);
$queue->setFlags(AMQP_NOPARAM);
$queue->declareQueue();
echo ' [*] Waiting for messages. To exit press CTRL+C ', PHP_EOL;
$queue->consume($callback_func);
} catch (AMQPQueueException $ex) {
print_r($ex);
} catch (Exception $ex) {
print_r($ex);
}
echo 'Close connection...', PHP_EOL;
$queue->cancel();
$connection->disconnect();
示例3: cancel
/**
* @inheritdoc
*/
public function cancel(string $consumerTag = '')
{
$this->queue->cancel($consumerTag);
}
示例4: cancel
/**
* @inheritdoc
*/
public function cancel($consumerTag = '')
{
return $this->delegate->cancel($consumerTag);
}