From 0fad2ed3e6620d0c18d4822bd8d099ecd752d491 Mon Sep 17 00:00:00 2001 From: Sam Dufel Date: Tue, 10 Feb 2015 08:24:18 -0800 Subject: [PATCH 1/3] Catch missing queue exeception on queueExists --- src/Provider/AwsProvider.php | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/Provider/AwsProvider.php b/src/Provider/AwsProvider.php index 646ed7e..94518aa 100755 --- a/src/Provider/AwsProvider.php +++ b/src/Provider/AwsProvider.php @@ -311,13 +311,15 @@ public function queueExists() return true; } - $result = $this->sqs->getQueueUrl([ - 'QueueName' => $this->getNameWithPrefix() - ]); + try { + $result = $this->sqs->getQueueUrl([ + 'QueueName' => $this->getNameWithPrefix() + ]); - if($this->queueUrl = $result->get('QueueUrl')) { - return true; - } + if ($this->queueUrl = $result->get('QueueUrl')) { + return true; + } + } catch (SqsException $e) {} return false; } From deb913743787a6503f9613d26f082715a394688a Mon Sep 17 00:00:00 2001 From: Sam Dufel Date: Tue, 10 Feb 2015 10:39:53 -0800 Subject: [PATCH 2/3] Add AWS check for topic existence --- src/Provider/AwsProvider.php | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/Provider/AwsProvider.php b/src/Provider/AwsProvider.php index 94518aa..181432b 100755 --- a/src/Provider/AwsProvider.php +++ b/src/Provider/AwsProvider.php @@ -23,6 +23,7 @@ namespace Uecode\Bundle\QPushBundle\Provider; use Aws\Common\Aws; +use Aws\Sns\Exception\NotFoundException; use Aws\Sqs\SqsClient; use Aws\Sqs\Exception\SqsException; use Doctrine\Common\Cache\Cache; @@ -411,6 +412,21 @@ public function topicExists() return true; } + if (!empty($this->queueUrl)) { + $queueArn = $this->sqs->getQueueArn($this->queueUrl); + $topicArn = str_replace('sqs', 'sns', $queueArn); + try { + $result = $this->sns->getTopicAttributes([ + 'TopicArn' => $topicArn + ]); + } catch (NotFoundException $e) { + return false; + } + $this->topicArn = $topicArn; + $this->cache->save($key, $this->topicArn); + return true; + } + return false; } From b496957ef911088bc7661460b1d19d74b6810e4d Mon Sep 17 00:00:00 2001 From: Keith Kirk Date: Fri, 18 Dec 2015 13:51:11 -0700 Subject: [PATCH 3/3] Add .idea to gitignore --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 88af70a..2732133 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,4 @@ /vendor /docs/_build /coverage +.idea