本文整理汇总了PHP中PhpAmqpLib\Channel\AMQPChannel::exchange_delete方法的典型用法代码示例。如果您正苦于以下问题:PHP AMQPChannel::exchange_delete方法的具体用法?PHP AMQPChannel::exchange_delete怎么用?PHP AMQPChannel::exchange_delete使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PhpAmqpLib\Channel\AMQPChannel
的用法示例。
在下文中一共展示了AMQPChannel::exchange_delete方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: tearDown
public function tearDown()
{
if ($this->ch) {
$this->ch->exchange_delete($this->exchange_name);
$this->ch->close();
}
if ($this->conn) {
$this->conn->close();
}
}
示例2: 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);
}
示例3: exchangeDelete
/**
* @param $name
*/
public function exchangeDelete($name)
{
$this->_channel->exchange_delete($name);
}