Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
nounous-archives
CransTicket
Commits
e0a0fb60
Commit
e0a0fb60
authored
Feb 23, 2015
by
Daniel STAN
Browse files
paramétrise la QUEUE côté serveur
parent
b0f3090c
Changes
2
Hide whitespace changes
Inline
Side-by-side
config.py.example
View file @
e0a0fb60
...
...
@@ -7,3 +7,5 @@ PARAMS = pika.ConnectionParameters(host='rabbitmq.crans.org',
port=5671, credentials=CREDS, ssl=True)
DEVICE = "/dev/ttyAMA0" #Ou USB0 sur oie
QUEUE = 'CransTicket' # ou 'CransTicketDebug' en test
daemon.py
View file @
e0a0fb60
...
...
@@ -12,12 +12,12 @@ import config
def
run
():
conn
=
pika
.
BlockingConnection
(
config
.
PARAMS
)
ch
=
conn
.
channel
()
ch
.
queue_declare
(
queue
=
'CransTicketDebug'
)
ch
.
queue_declare
(
queue
=
config
.
QUEUE
)
def
callback
(
ch
,
method
,
properties
,
body
):
print
(
" [x] Received %r"
%
(
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
()
conn
.
close
()
# fork en arrière plan + pidfile
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment