crans_ticket/daemon.py
2014-07-11 17:59:17 +02:00

17 lines
427 B
Python
Executable file

#!/usr/bin/env python
import pika
import json
import dump
conn = pika.BlockingConnection(pika.ConnectionParameters(host='civet.crans.org'))
ch = conn.channel()
ch.queue_declare(queue='CransTicket')
def callback(ch, method, properties, body):
print " [x] Received %r" % (body,)
dump.print_liste(json.loads(body))
ch.basic_consume(callback, queue='CransTicket', no_ack=True)
ch.start_consuming()
conn.close()