Created
September 29, 2015 17:51
-
-
Save jconnolly/3cb345b8b99abee09f34 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
# example_publisher.py | |
import pika, os, logging | |
logging.basicConfig() | |
url = 'amqp://guest:guest@localhost:5672/%2F' | |
params = pika.URLParameters(url) | |
params.socket_timeout = 5 | |
connection = pika.BlockingConnection(params) # Connect to CloudAMQP | |
channel = connection.channel() # start a channel | |
channel.queue_declare(durable=True, queue='new-user-confirm-email') # Declare a queue | |
# send a message | |
channel.basic_publish(exchange='event', routing_key='new.user', body='{"email":"jeconnol@gmail.com"}') | |
print " [x] Message sent to consumer" | |
connection.close() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment