本文整理汇总了PHP中AMQPExchange::delete方法的典型用法代码示例。如果您正苦于以下问题:PHP AMQPExchange::delete方法的具体用法?PHP AMQPExchange::delete怎么用?PHP AMQPExchange::delete使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AMQPExchange
的用法示例。
在下文中一共展示了AMQPExchange::delete方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: delete
/**
* @param string $exchangeName
* @param int $flags
*
* @return bool
*/
public function delete($exchangeName = null, $flags = Client::NOPARAM)
{
try {
return $this->rawExchange->delete($exchangeName, $flags);
} catch (\Exception $e) {
ClientHelper::throwRightException($e);
}
}
示例2: delete
/**
* @inheritdoc
*/
public function delete($exchangeName = null, $flags = null)
{
try {
return $this->delegate->delete($exchangeName, self::convertToDelegateFlags($flags));
} catch (\AMQPExchangeException $e) {
throw new ExchangeException($e->getMessage(), $e->getCode(), $e);
} catch (\AMQPChannelException $e) {
throw new ChannelException($e->getMessage(), $e->getCode(), $e);
} catch (\AMQPConnectionException $e) {
throw new ConnectionException($e->getMessage(), $e->getCode(), $e);
}
}
示例3: 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();
示例4: AMQPConnection
<?php
// print_r( get_loaded_extensions() );
$cnn = new AMQPConnection();
echo "------ connect ... --------\n";
$ret = $cnn->connect();
echo "------ connect Ok --------\n";
$ch = new AMQPChannel($cnn);
$ex = new AMQPExchange($ch);
echo "------ exchange Ok --------\n";
// $cnn->disconnect(AMQP_NOPARAM);
$ex->setName('test_e');
$ex->delete();
$cnn->disconnect();
示例5: delete
/**
* @inheritdoc
*/
public function delete(string $exchangeName = '', int $flags = Constants::AMQP_NOPARAM)
{
$this->exchange->delete($exchangeName, $flags);
}
示例6: send
private function send($msg)
{
// Attach to well known server ETL and send message.
$request_queue = new AMQPQueue($this->channel);
$request_queue->setName("queue-well-known-rpc-name");
$request_queue->declareQueue();
$request_exch = new AMQPExchange($this->channel);
$request_exch->setName("exchange-well-known-rpc-name");
$request_exch->setType(AMQP_EX_TYPE_FANOUT);
$request_exch->declareExchange();
$request_queue->bind($request_exch->getName());
$request_exch->publish($msg, null, AMQP_NOPARAM, ['correlation_id' => $this->correlation_id, 'reply_to' => $this->reply_queue->getName()]);
$request_exch->delete();
}