From 876a3faa078713c6cba7e05340b06157053888b3 Mon Sep 17 00:00:00 2001 From: "nicolas.couet" Date: Wed, 8 Jun 2016 16:47:57 +0200 Subject: [PATCH] Change from error to warning when try to add alias on unknown queue --- CHANGELOG.md | 4 ++++ QueueClientFactory.php | 6 ++++++ 2 files changed, 10 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 34dbb4a..b6f26aa 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # Queue Client Bundle Changelog +## v1.0.3 + +- Change from error to warning when try to add alias on unknown queue + ## v1.0.2 - Add AWS backwards compatibility diff --git a/QueueClientFactory.php b/QueueClientFactory.php index 98304aa..c21ab3f 100644 --- a/QueueClientFactory.php +++ b/QueueClientFactory.php @@ -2,8 +2,10 @@ namespace ReputationVIP\Bundle\QueueClientBundle; +use Psr\Log\LoggerInterface; use ReputationVIP\Bundle\QueueClientBundle\Configuration\QueuesConfiguration; use ReputationVIP\QueueClient\Adapter\AdapterInterface; +use ReputationVIP\QueueClient\Adapter\Exception\QueueAccessException; use ReputationVIP\QueueClient\QueueClient; use ReputationVIP\QueueClient\QueueClientInterface; use Symfony\Component\Config\Definition\Processor; @@ -42,6 +44,8 @@ public static function resolveParameters(&$item, $key, $container) */ public function get($container, $adapter, $queuesFile) { + /** @var LoggerInterface $logger */ + $logger = $container->get('logger'); $queueClient = new QueueClient($adapter); $processor = new Processor(); $configuration = new QueuesConfiguration(); @@ -53,6 +57,8 @@ public function get($container, $adapter, $queuesFile) foreach ($queue[QueuesConfiguration::QUEUE_ALIASES_NODE] as $alias) { try { $queueClient->addAlias($queueName, $alias); + } catch (QueueAccessException $e) { + $logger->warning($e->getMessage()); } catch (\ErrorException $e) { if ($e->getSeverity() === E_ERROR) { throw $e;