Created
February 10, 2020 15:40
-
-
Save shivamMg/2a24668b3c51bd94fe3c06f25c10a97d to your computer and use it in GitHub Desktop.
Test librabbitmq: https://github.com/rapyuta-robotics/librabbitmq
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from librabbitmq import Connection | |
| conn = Connection( | |
| host='<host>:443', | |
| userid='<userid>', | |
| password='<password>', | |
| virtual_host='/', | |
| ssl={ | |
| 'server_hostname': '<host>' | |
| }, | |
| ) | |
| channel = conn.channel() | |
| channel.exchange_declare(exchange='exch') | |
| result = channel.queue_declare(queue='') | |
| channel.queue_bind(queue=result.queue, exchange='exch', routing_key='') | |
| channel.basic_publish(exchange='exch', routing_key='', body='body msg') | |
| conn.close() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from librabbitmq import Connection | |
| conn = Connection( | |
| host='<host>:443', | |
| userid='<userid>', | |
| password='<password>', | |
| virtual_host='/', | |
| ssl={ | |
| 'server_hostname': '<host>' | |
| }, | |
| ) | |
| channel = conn.channel() | |
| channel.exchange_declare(exchange='exch') | |
| result = channel.queue_declare(queue='') | |
| channel.queue_bind(queue=result.queue, exchange='exch', routing_key='') | |
| def callback(message): | |
| print("Body:'%s', Properties:'%s', DeliveryInfo:'%s'" % ( | |
| message.body.tobytes(), message.properties, message.delivery_info)) | |
| channel.basic_consume(queue=result.queue, callback=callback) | |
| print 'loop' | |
| conn.drain_events() | |
| conn.close() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment