Skip to content

Instantly share code, notes, and snippets.

@skillachie
Created June 27, 2014 04:09
Show Gist options
  • Save skillachie/7e0f4c50b6ccbd380179 to your computer and use it in GitHub Desktop.
Save skillachie/7e0f4c50b6ccbd380179 to your computer and use it in GitHub Desktop.
#!/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