Created
July 25, 2017 17:16
-
-
Save remyleone/92d8606074f4336d4bffa578da7684e5 to your computer and use it in GitHub Desktop.
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
| import pika | |
| # Open a connection to RabbitMQ on localhost using all default parameters | |
| connection = pika.BlockingConnection(pika.URLParameters("amqp://JJLCGMV3:BZ1LVK05@finterop-mq.noc.onelab.eu:443/8daf40a5-8ba4-40fd-b583-e05abf6c7e09")) | |
| # Open the channel | |
| channel = connection.channel() | |
| # Declare the queue | |
| channel.queue_declare(queue="test", durable=True, exclusive=False, auto_delete=False) | |
| # Enabled delivery confirmations | |
| channel.confirm_delivery() | |
| # Send a message | |
| if channel.basic_publish(exchange='default', | |
| routing_key='gui.display', | |
| body='Hello World!', | |
| properties=pika.BasicProperties(content_type='text/plain', | |
| delivery_mode=1), | |
| mandatory=True): | |
| print 'Message was published' | |
| else: | |
| print 'Message was returned' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment