Skip to content

Instantly share code, notes, and snippets.

@arkilis
Created August 31, 2017 23:35
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 arkilis/e48606239023759b5bbc5d70f5396e3b to your computer and use it in GitHub Desktop.
Save arkilis/e48606239023759b5bbc5d70f5396e3b to your computer and use it in GitHub Desktop.
import sys
import pika
parameters = pika.URLParameters('amqp://guest:guest@localhost:5672/%2F')
connection = pika.BlockingConnection(parameters)
channel = connection.channel()
channel.exchange_declare(exchange='web_develop', exchange_type='direct',
passive=False, durable=True, auto_delete=False)
if len(sys.argv) != 1:
msg = sys.argv[1]
else:
msg = 'hah'
props = pika.BasicProperties(content_type='text/plain', delivery_mode=2)
channel.basic_publish('web_develop', 'xxx_routing_key', msg,
properties=props)
connection.close()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment