petit demon rabbitmq
This commit is contained in:
parent
a3185bdce4
commit
73bc370e59
2 changed files with 40 additions and 18 deletions
17
daemon.py
Executable file
17
daemon.py
Executable 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()
|
Loading…
Add table
Add a link
Reference in a new issue