Create a gist now

Instantly share code, notes, and snippets.

#!/usr/bin/env python
import pika
import sys
#Example publisher code take from RabbitMQ topic tutorial
routing_key = sys.argv[1] if len(sys.argv) > 1 else 'anonymous.info'
message = ' '.join(sys.argv[2:]) or 'Hello World!'
channel.basic_publish(exchange='data_gateway',
routing_key=routing_key,
body=message,
properties=pika.BasicProperties(delivery_mode =2,))
print " [x] Sent %r:%r" % (routing_key, message)
connection.close()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment