Skip to content

Commit

Permalink
Adds DLQ tag to created queues
Browse files Browse the repository at this point in the history
  • Loading branch information
corydolphin committed Jul 12, 2021
1 parent 398089a commit 7aaf0ab
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions kale/sqs.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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
Expand Down

0 comments on commit 7aaf0ab

Please sign in to comment.