Skip to content
Snippets Groups Projects

fix(user_reg_event_logger): remove assumption on routing_key

Merged Bo-Chun Chen requested to merge louistw/rabbitmq_agents:fix-user-reg-event-agent into main
1 file
+ 1
4
Compare changes
  • Side-by-side
  • Inline
@@ -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
Loading