#!/usr/bin/env python

import pika
import sys

def process(message):	

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

	channel.queue_declare(queue='hello')

	channel.basic_publish(exchange='',
						routing_key='hello',
						body=message,
						properties=pika.BasicProperties(
                        	delivery_mode = 2, # make message persistent
                     	))

	print(" [x] Sent %r" % message) 

	connection.close()

if __name__ == '__main__':
	while 1: 
		message = raw_input('Enter Message: ')
		process(' '.join(message))