本文整理汇总了PHP中Aws\Sqs\SqsClient::deleteQueue方法的典型用法代码示例。如果您正苦于以下问题:PHP SqsClient::deleteQueue方法的具体用法?PHP SqsClient::deleteQueue怎么用?PHP SqsClient::deleteQueue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Aws\Sqs\SqsClient
的用法示例。
在下文中一共展示了SqsClient::deleteQueue方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testCreateQueue
public function testCreateQueue()
{
$queueName = 'test_queue';
$db = DriverManager::getConnection(['driver' => 'pdo_mysql', 'host' => SYRUP_DATABASE_HOST, 'dbname' => SYRUP_DATABASE_NAME, 'user' => SYRUP_DATABASE_USER, 'password' => SYRUP_DATABASE_PASSWORD, 'port' => SYRUP_DATABASE_PORT]);
$db->query("DELETE FROM queues WHERE id='{$queueName}'")->execute();
$command = $this->application->find('syrup:queue:create');
$commandTester = new CommandTester($command);
$commandTester->execute(['name' => $queueName, '--register' => null, '--no-watch' => null]);
$this->assertEquals(0, $commandTester->getStatusCode());
$factory = new QueueFactory($db, ['db_table' => 'queues'], SYRUP_APP_NAME);
$dbQueue = $factory->get($queueName);
$queueUrlArr = explode('/', $dbQueue->getUrl());
$this->assertEquals($queueName, array_pop($queueUrlArr));
$sqsClient = new SqsClient(['version' => '2012-11-05', 'region' => 'us-east-1']);
$sqsClient->deleteQueue(['QueueUrl' => $dbQueue->getUrl()]);
}
示例2: testCreate
public function testCreate()
{
$db = DriverManager::getConnection(['driver' => 'pdo_mysql', 'host' => SYRUP_DATABASE_HOST, 'dbname' => SYRUP_DATABASE_NAME, 'user' => SYRUP_DATABASE_USER, 'password' => SYRUP_DATABASE_PASSWORD, 'port' => SYRUP_DATABASE_PORT]);
$factory = new QueueFactory($db, ['db_table' => 'queues'], SYRUP_APP_NAME);
$sqsQueue = $factory->create('test');
$queueUrlArr = explode('/', $sqsQueue->get('QueueUrl'));
$this->assertEquals('test', array_pop($queueUrlArr));
// delete the queue from AWS
$sqsClient = new SqsClient(['version' => '2012-11-05', 'region' => 'us-east-1']);
$sqsClient->deleteQueue(['QueueUrl' => $sqsQueue->get('QueueUrl')]);
}
示例3: remove
/**
* {@inheritDoc}
*/
public function remove(QueueAdapterInterface $queue)
{
if (!$queue instanceof SqsQueue) {
throw new InvalidArgumentException('expecting an instance of SqsQueue');
}
try {
$this->client->deleteQueue(['QueueUrl' => $queue->getUrl()]);
} catch (\Exception $ex) {
throw new RuntimeException($ex->getMessage(), $ex->getCode(), $ex);
}
}
示例4: deleteQueue
/**
* @inheritdoc
*
* @throws SqsException
*/
public function deleteQueue($queueName)
{
if (empty($queueName)) {
throw new InvalidArgumentException('Parameter queueName empty or not defined.');
}
$priorities = $this->priorityHandler->getAll();
foreach ($priorities as $priority) {
$queueUrl = $this->sqsClient->getQueueUrl(['QueueName' => $this->getQueueNameWithPrioritySuffix($queueName, $priority)])->get('QueueUrl');
$this->sqsClient->deleteQueue(['QueueUrl' => $queueUrl]);
}
return $this;
}
示例5: deleteQueue
/**
* @inheritdoc
*
* @throws \InvalidArgumentException
* @throws QueueAccessException
*/
public function deleteQueue($queueName)
{
if (empty($queueName)) {
throw new \InvalidArgumentException('Queue name empty or not defined.');
}
$priorities = $this->priorityHandler->getAll();
foreach ($priorities as $priority) {
try {
$queueUrl = $this->sqsClient->getQueueUrl(['QueueName' => $this->getQueueNameWithPrioritySuffix($queueName, $priority)])->get('QueueUrl');
$this->sqsClient->deleteQueue(['QueueUrl' => $queueUrl]);
} catch (SqsException $e) {
throw new QueueAccessException('Cannot delete queue.', 0, $e);
}
}
return $this;
}
示例6: destroy
/**
* @return Boolean
*/
public function destroy()
{
$key = $this->getNameWithPrefix() . '_url';
$this->cache->delete($key);
if ($this->queueExists()) {
// Delete the SQS Queue
$this->sqs->deleteQueue(['QueueUrl' => $this->queueUrl]);
$this->log(200, "SQS Queue removed", ['QueueUrl' => $this->queueUrl]);
}
$key = $this->getNameWithPrefix() . '_arn';
$this->cache->delete($key);
if ($this->topicExists() || !empty($this->queueUrl)) {
// Delete the SNS Topic
$topicArn = !empty($this->topicArn) ? $this->topicArn : str_replace('sqs', 'sns', $this->queueUrl);
$this->sns->deleteTopic(['TopicArn' => $topicArn]);
$this->log(200, "SNS Topic removed", ['TopicArn' => $topicArn]);
}
return true;
}
示例7: deleteQueue
/**
* {@inheritDoc}
*/
public function deleteQueue($queueId = null)
{
$queueUrl = $this->getQueueUrl($queueId);
$this->queueClient->deleteQueue(["QueueUrl" => $queueUrl]);
}
示例8: deleteQueue
public function deleteQueue()
{
$args = ["QueueUrl" => $this->getQueueUrl()];
$this->client->deleteQueue($args);
}