#!/usr/bin/env python
# -*- coding:utf-8 -*-

import pika

connection = pika.BlockingConnection(pika.ConnectionParameters('localhost'))

channel = connection.channel()

channel.queue_declare(queue='hello')

while True:
    data = raw_input('>>>')
    if data == 'q':
        break
    channel.basic_publish(exchange='',
        routing_key='hello',
        body=data)
    print "[X] Sent 'Hello World!'"

connection.close()
