Commit fa3d65f5 by Javi Mateos

primer commit

parents
#!/usr/bin/env python
import pika
rabbitmq_host = 'localhost'
connection = pika.BlockingConnection(pika.ConnectionParameters(
host = rabbitmq_host))
channel = connection.channel()
channel.queue_declare(queue='beer_queue')
def callback(ch, method, properties, body):
print(" [x] Received %r" % body)
channel.basic_consume(callback,
queue='beer_queue',
no_ack=True)
print(' [*] Waiting for messages. To exit press CTRL+C')
channel.start_consuming()
#!/usr/bin/env python
import pika
import os
rabbitmq_host = 'localhost'
connection = pika.BlockingConnection(pika.ConnectionParameters(rabbitmq_host))
channel = connection.channel()
channel.queue_declare(queue='beer_queue')
channel.basic_publish(exchange='',
routing_key='beer_queue',
body='{"Name","style","brewer","ABV","IBU"}')
print(" [x] Sent message to " +rabbitmq_host)
connection.close()
os.system('rabbitmqctl list_queues')
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment