Skip to content

Instantly share code, notes, and snippets.

@koolhead17
Last active September 11, 2016 21:43
Show Gist options
  • Select an option

  • Save koolhead17/a55730354a4d4e1b9e289adf1e22eeba to your computer and use it in GitHub Desktop.

Select an option

Save koolhead17/a55730354a4d4e1b9e289adf1e22eeba to your computer and use it in GitHub Desktop.
#!/usr/bin/env python
import pika
connection = pika.BlockingConnection(pika.ConnectionParameters(
host='localhost'))
channel = connection.channel()
channel.exchange_declare(exchange='bucketevents',
type='fanout')
result = channel.queue_declare(exclusive=False)
queue_name = result.method.queue
channel.queue_bind(exchange='bucketevents',
queue=queue_name)
print(' [*] Waiting for logs. To exit press CTRL+C')
def callback(ch, method, properties, body):
print(" [x] %r" % body)
channel.basic_consume(callback,
queue=queue_name,
no_ack=False)
channel.start_consuming()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment