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

Update README

parent da2dd4c9
No related branches found
No related tags found
2 merge requests!23Feat resolve uid gid,!9Feat connection module
...@@ -27,4 +27,21 @@ rc_rmq.publish_msg({ ...@@ -27,4 +27,21 @@ rc_rmq.publish_msg({
'content': 'this is warning' 'content': 'this is warning'
} }
}) })
# to consume message from a queue
# you have to first define callback function
# with parameters: channel, method, properties, body
def callback_function(ch, method, properties, body):
msg = json.loads(body)
print("get msg: {}".format(msg['username')
# this will stop the consumer
rc_rmq.stop_consumer()
# start consume messagre from queue with callback function
rc_rmq.start_consume({
'queue': 'queue_name',
'cb': callback_function
})
``` ```
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