Skip to content

Instantly share code, notes, and snippets.

@lukebakken
Last active August 1, 2018 18:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lukebakken/56c115c5fe5d329763ca367e2ce16d01 to your computer and use it in GitHub Desktop.
Save lukebakken/56c115c5fe5d329763ca367e2ce16d01 to your computer and use it in GitHub Desktop.
rabbitmq.config
*.bin
*env*/
*.pyc
  • pip install pika
  • python ./repro.py
#!/usr/bin/env python
import pika
import ssl
ssl_options = dict(
certfile = "C:/PATH/TO/client_certificate.pem",
keyfile = "C:/PATH/TO/client_key.pem",
ca_certs = "C:/PATH/TO/ca_certificate.pem",
cert_reqs = ssl.CERT_REQUIRED)
creds = pika.PlainCredentials('guest', 'guest')
parameters = pika.ConnectionParameters(
host = "localhost",
port = 5671,
virtual_host = "/",
credentials = creds,
ssl = True,
ssl_options = ssl_options)
props = pika.BasicProperties(delivery_mode = 2)
con = pika.BlockingConnection(parameters)
ch = con.channel()
ch.basic_publish(exchange='', routing_key='gh-1082', properties=props, body='TEST MESSAGE')
ch.close()
con.close()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment