From 7aaf0ab623e00ddd550556dc459d99264316ce8e Mon Sep 17 00:00:00 2001 From: Cory Dolphin Date: Mon, 12 Jul 2021 17:18:17 -0600 Subject: [PATCH] Adds DLQ tag to created queues --- kale/sqs.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/kale/sqs.py b/kale/sqs.py index bc1b718..4e40f8e 100644 --- a/kale/sqs.py +++ b/kale/sqs.py @@ -55,12 +55,13 @@ def __init__(self, *args, **kwargs): self._client = self._session.client('sqs', endpoint_url=endpoint_url) self._sqs = self._session.resource('sqs', endpoint_url=endpoint_url) - def _get_or_create_queue(self, queue_name): + def _get_or_create_queue(self, queue_name, is_dlq=False): """Fetch or create a queue. :param str queue_name: string for queue name. + :param bool is_dlq:True iff the queue is a dead letter queue and should be tagged as such :return: Queue - :rtype: boto3.resources.factory.sqs.Queue + :rtype: boto3.resources.factory.sqs.Queue """ # Check local cache first. @@ -76,7 +77,7 @@ def _get_or_create_queue(self, queue_name): raise e logger.info('Creating new SQS queue: %s' % queue_name) - queue = self._client.create_queue(QueueName=queue_name) + queue = self._client.create_queue(QueueName=queue_name, tags={"dlq":str(is_dlq)}) queue_url = queue.get('QueueUrl') # create queue object