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

Update consume in rc_util

Now consume can take routing key as argument
parent 9f9dc909
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,!39WIP:Feat cod rmq,!33Update create account script,!38WIP: Feat cod rmq
...@@ -35,13 +35,16 @@ def worker(ch, method, properties, body): ...@@ -35,13 +35,16 @@ def worker(ch, method, properties, body):
rc_rmq.stop_consume() rc_rmq.stop_consume()
rc_rmq.delete_queue() rc_rmq.delete_queue()
def consume(username, callback=worker, debug=False): def consume(username, routing_key='', callback=worker, debug=False):
if routing_key == '':
routing_key = 'confirm.' + username
if debug: if debug:
sleep(5) sleep(5)
else: else:
rc_rmq.start_consume({ rc_rmq.start_consume({
'queue': username, 'queue': username,
'routing_key': 'confirm.' + username, 'routing_key': routing_key,
'cb': callback 'cb': callback
}) })
rc_rmq.disconnect() rc_rmq.disconnect()
......
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