From 03989c09de2b54f09e76adce7d19c7cea4523dc0 Mon Sep 17 00:00:00 2001 From: Rebecca Law Date: Thu, 28 Jan 2016 11:09:25 +0000 Subject: [PATCH] Add message id to message attributes --- app/notifications/rest.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/notifications/rest.py b/app/notifications/rest.py index 3a74d9341..9b7b73a4e 100644 --- a/app/notifications/rest.py +++ b/app/notifications/rest.py @@ -138,7 +138,8 @@ def _add_notification_to_queue(template_id, service, msg_type, to): q = boto3.resource('sqs', region_name=current_app.config['AWS_REGION']).create_queue( QueueName=str(service.queue_name)) import uuid - notification = json.dumps({'message_id': str(uuid.uuid4()), + message_id = str(uuid.uuid4()) + notification = json.dumps({'message_id': message_id, 'service_id': service.id, 'to': to, 'message_type': msg_type, @@ -147,5 +148,6 @@ def _add_notification_to_queue(template_id, service, msg_type, to): encrypted = serializer.dumps(notification, current_app.config.get('DANGEROUS_SALT')) q.send_message(MessageBody=encrypted, MessageAttributes={'type': {'StringValue': msg_type, 'DataType': 'String'}, + 'message_id': {'StringValue': message_id, 'DataType': 'String'}, 'service_id': {'StringValue': str(service.id), 'DataType': 'String'}, 'template_id': {'StringValue': str(template_id), 'DataType': 'String'}})