rabbitmq-tutorials/python/send.py
2010-09-24 14:50:20 +00:00

17 lines
411 B
Python
Executable File

#!/usr/bin/env python
import pika
connection = pika.AsyncoreConnection(pika.ConnectionParameters(
host='127.0.0.1',
credentials=pika.PlainCredentials('guest', 'guest')))
channel = connection.channel()
channel.queue_declare(queue='test')
channel.basic_publish(exchange='',
routing_key='test',
body='Hello World!')
print " [x] Sent 'Hello World!'"