From cc5dad3744f0b9f0278a44894399c3de358c4fd8 Mon Sep 17 00:00:00 2001 From: Nicholas Staples Date: Fri, 5 Feb 2016 11:12:59 +0000 Subject: [PATCH] Update queues with a prefix. --- app/aws_sqs.py | 4 +++- config.py | 2 ++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/app/aws_sqs.py b/app/aws_sqs.py index 3d6317b2a..86b28eab8 100644 --- a/app/aws_sqs.py +++ b/app/aws_sqs.py @@ -7,7 +7,9 @@ from flask import current_app def add_notification_to_queue(service_id, template_id, type_, notification): q = boto3.resource( 'sqs', region_name=current_app.config['AWS_REGION'] - ).create_queue(QueueName=str(service_id)) + ).create_queue(QueueName="{}_{}".format( + current_app.config['NOTIFICATION_QUEUE_PREFIX'], + str(service_id))) message_id = str(uuid.uuid4()) serializer = URLSafeSerializer(current_app.config.get('SECRET_KEY')) encrypted = serializer.dumps(notification, current_app.config.get('DANGEROUS_SALT')) diff --git a/config.py b/config.py index 14d595348..8329e0edf 100644 --- a/config.py +++ b/config.py @@ -16,6 +16,8 @@ class Config(object): AWS_REGION = 'eu-west-1' NOTIFY_JOB_QUEUE = os.getenv('NOTIFY_JOB_QUEUE', 'notify-jobs-queue') + # Notification Queue names are a combination of a prefx plus a name + NOTIFICATION_QUEUE_PREFIX = 'notification' class Development(Config):