paramétrise la QUEUE côté serveur
This commit is contained in:
parent
b0f3090cfe
commit
e0a0fb60c8
2 changed files with 4 additions and 2 deletions
|
@ -7,3 +7,5 @@ PARAMS = pika.ConnectionParameters(host='rabbitmq.crans.org',
|
||||||
port=5671, credentials=CREDS, ssl=True)
|
port=5671, credentials=CREDS, ssl=True)
|
||||||
|
|
||||||
DEVICE = "/dev/ttyAMA0" #Ou USB0 sur oie
|
DEVICE = "/dev/ttyAMA0" #Ou USB0 sur oie
|
||||||
|
|
||||||
|
QUEUE = 'CransTicket' # ou 'CransTicketDebug' en test
|
||||||
|
|
|
@ -12,12 +12,12 @@ import config
|
||||||
def run():
|
def run():
|
||||||
conn = pika.BlockingConnection(config.PARAMS)
|
conn = pika.BlockingConnection(config.PARAMS)
|
||||||
ch = conn.channel()
|
ch = conn.channel()
|
||||||
ch.queue_declare(queue='CransTicketDebug')
|
ch.queue_declare(queue=config.QUEUE)
|
||||||
def callback(ch, method, properties, body):
|
def callback(ch, method, properties, body):
|
||||||
print (" [x] Received %r" % (body,))
|
print (" [x] Received %r" % (body,))
|
||||||
dump.print_liste(json.loads(body))
|
dump.print_liste(json.loads(body))
|
||||||
|
|
||||||
ch.basic_consume(callback, queue='CransTicketDebug', no_ack=True)
|
ch.basic_consume(callback, queue=config.QUEUE, no_ack=True)
|
||||||
ch.start_consuming()
|
ch.start_consuming()
|
||||||
conn.close()
|
conn.close()
|
||||||
# fork en arrière plan + pidfile
|
# fork en arrière plan + pidfile
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue