Skip to content

Commit

Permalink
Update message_id handling for response routing (#92)
Browse files Browse the repository at this point in the history
* Update `message_id` handling for response routing

* Fix typo in default value handling

* Make context reference safe
  • Loading branch information
NeonDaniel authored Aug 11, 2023
1 parent 436c73d commit 3de112a
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion neon_mq_connector/connector.py
Original file line number Diff line number Diff line change
Expand Up @@ -368,7 +368,10 @@ def emit_mq_message(cls,
if not request_data:
raise ValueError(f'No request data provided')

message_id = request_data.setdefault('message_id', cls.create_unique_id())
# Ensure `message_id` in data will match context in messagebus connector
request_data.setdefault('message_id', request_data.get("context", {})
.get("mq", {}).get("message_id") or
cls.create_unique_id())

with connection.channel() as channel:
if exchange:
Expand Down

0 comments on commit 3de112a

Please sign in to comment.