Skip to content
Snippets Groups Projects
Commit 6bd5bfbf authored by Bo-Chun Chen's avatar Bo-Chun Chen
Browse files

fix: remove assumption on routing_key

parent 566ce576
No related branches found
No related tags found
1 merge request!151fix(user_reg_event_logger): remove assumption on routing_key
......@@ -10,15 +10,12 @@ rc_rmq = RCRMQ({"exchange": "RegUsr", "exchange_type": "topic"})
# Define your callback function
def log_user_reg_events(ch, method, properties, body):
# Retrieve message
msg = json.loads(body)
# Retrieve routing key
routing_key = method.routing_key
action = routing_key.split(".")[0]
user = routing_key.split(".")[1]
print(f"Got a {action} message for {user} with routing key: {routing_key}")
print(f"Got a message with routing key: {routing_key}")
print(msg)
# Acknowledge message
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment