Created
August 31, 2017 23:35
-
-
Save arkilis/e48606239023759b5bbc5d70f5396e3b to your computer and use it in GitHub Desktop.
This file contains 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 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