Skip to content
Snippets Groups Projects
Commit e096eef6 authored by Mitchell Moore's avatar Mitchell Moore
Browse files

add basic ohpc consumer

parent cf7a9fc7
No related branches found
No related tags found
2 merge requests!35Version 1b openstack rabbitmq,!29Create base producer/consumers
#!/usr/bin/env python
import pika
import sys
connection = pika.BlockingConnection(
pika.ConnectionParameters(host='localhost'))
channel = connection.channel()
channel.exchange_declare(exchange='direct_logs', exchange_type='direct')
result = channel.queue_declare(queue='', exclusive=True)
queue_name = result.method.queue
channel.queue_bind(
exchange='direct_logs', queue=queue_name, routing_key="ohpc")
print(' [*] Waiting for logs. To exit press CTRL+C')
def callback(ch, method, properties, body):
print(" [x] %r:%r" % (method.routing_key, body))
channel.basic_consume(
queue=queue_name, on_message_callback=callback, auto_ack=True)
channel.start_consuming()
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment