From 225fd1319ce3dbcd675adc52b5210139b3126f27 Mon Sep 17 00:00:00 2001 From: NeonKirill <74428618+NeonKirill@users.noreply.github.com> Date: Thu, 27 Jul 2023 00:54:49 +0200 Subject: [PATCH] Bug Fix: Setting Generated Message ID as default value, skipping it while already set (#90) --- neon_mq_connector/connector.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/neon_mq_connector/connector.py b/neon_mq_connector/connector.py index d15e5fd..779de2d 100644 --- a/neon_mq_connector/connector.py +++ b/neon_mq_connector/connector.py @@ -363,10 +363,8 @@ def emit_mq_message(cls, :raises ValueError: invalid request data provided :returns message_id: id of the sent message """ - if request_data and len(request_data) > 0 and isinstance(request_data, - dict): - message_id = cls.create_unique_id() - request_data['message_id'] = message_id + if request_data and len(request_data) > 0 and isinstance(request_data, dict): + message_id = request_data.setdefault('message_id', cls.create_unique_id()) with connection.channel() as channel: if exchange: channel.exchange_declare(exchange=exchange,