mirror of
https://github.com/GSA/notifications-api.git
synced 2026-02-03 09:51:11 -05:00
Add message id to message attributes
This commit is contained in:
@@ -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(
|
q = boto3.resource('sqs', region_name=current_app.config['AWS_REGION']).create_queue(
|
||||||
QueueName=str(service.queue_name))
|
QueueName=str(service.queue_name))
|
||||||
import uuid
|
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,
|
'service_id': service.id,
|
||||||
'to': to,
|
'to': to,
|
||||||
'message_type': msg_type,
|
'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'))
|
encrypted = serializer.dumps(notification, current_app.config.get('DANGEROUS_SALT'))
|
||||||
q.send_message(MessageBody=encrypted,
|
q.send_message(MessageBody=encrypted,
|
||||||
MessageAttributes={'type': {'StringValue': msg_type, 'DataType': 'String'},
|
MessageAttributes={'type': {'StringValue': msg_type, 'DataType': 'String'},
|
||||||
|
'message_id': {'StringValue': message_id, 'DataType': 'String'},
|
||||||
'service_id': {'StringValue': str(service.id), 'DataType': 'String'},
|
'service_id': {'StringValue': str(service.id), 'DataType': 'String'},
|
||||||
'template_id': {'StringValue': str(template_id), 'DataType': 'String'}})
|
'template_id': {'StringValue': str(template_id), 'DataType': 'String'}})
|
||||||
|
|||||||
Reference in New Issue
Block a user