petit demon rabbitmq

This commit is contained in:
Daniel STAN 2014-07-11 17:52:04 +02:00
parent a3185bdce4
commit 73bc370e59
2 changed files with 40 additions and 18 deletions

17
daemon.py Executable file
View file

@ -0,0 +1,17 @@
#!/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()