Skip to content
Snippets Groups Projects
Commit a0f2334d authored by Eesaan Atluri's avatar Eesaan Atluri
Browse files

Add functionality for event logging

parent 52398bd5
No related branches found
No related tags found
6 merge requests!147Merge previous default branch feat-cod-rmq into main,!85kill nginx process running under user from login node,!51Fix acct create wait,!32Feat user reg event logger,!39WIP:Feat cod rmq,!38WIP: Feat cod rmq
......@@ -11,14 +11,20 @@ rc_rmq = RCRMQ({'exchange': 'RegUsr', 'exchange_type': 'topic'})
# Define your callback function
def log_user_reg_events(ch, method, properties, body):
# Retrieve routing key
routing_key = method.routing_key
print(routing_key)
# Retrieve message
msg = json.loads(body)
print(msg)
# Do Something
print('[{}]: Callback called.'.format(task))
#print(msg)
# Retrieve routing key
routing_key = method.routing_key
action = routing_key.split(".")[0]
user = routing_key.split(".")[1]
if action != 'confirm':
print(f'Got a message for {user}: {routing_key}')
else:
task = msg['task']
status = msg['success']
print(f'Task {task} completed?: {status}')
# Acknowledge message
ch.basic_ack(delivery_tag=method.delivery_tag)
......
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