Skip to content

Instantly share code, notes, and snippets.

@remyleone
Created July 25, 2017 17:16
Show Gist options
  • Select an option

  • Save remyleone/92d8606074f4336d4bffa578da7684e5 to your computer and use it in GitHub Desktop.

Select an option

Save remyleone/92d8606074f4336d4bffa578da7684e5 to your computer and use it in GitHub Desktop.
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