Merge pull request #55 from alphagov/update_queue_names

Update queues with a prefix.
This commit is contained in:
Adam Shimali
2016-02-05 11:24:45 +00:00
2 changed files with 5 additions and 1 deletions

View File

@@ -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'))

View File

@@ -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):