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
f-interop-contributors
utils
Commits
0ee50062
Commit
0ee50062
authored
Nov 27, 2017
by
Federico Sismondi
Browse files
thread handles amqp connection independenlty now
parent
4d471ae5
Changes
1
Show whitespace changes
Inline
Side-by-side
cli.py
View file @
0ee50062
...
...
@@ -94,18 +94,18 @@ class NullLogHandler(logging.Handler):
class
AmqpSniffer
(
threading
.
Thread
):
COMPONENT_ID
=
'amqp_sniffer_%s'
%
uuid
.
uuid1
()
DEFAULT_EXCHAGE
=
'amq.topic'
DEFAULT_URL
=
'amqp://guest:guest@localhost'
def
__init__
(
self
,
c
on
n
,
exchange
=
None
,
topics
=
None
):
def
__init__
(
self
,
url
=
N
on
e
,
exchange
=
None
,
topics
=
None
):
threading
.
Thread
.
__init__
(
self
)
if
exchange
:
self
.
exchange
=
exchange
else
:
self
.
exchange
=
self
.
DEFAULT_EXCHAGE
self
.
exchange
=
exchange
if
exchange
else
self
.
DEFAULT_EXCHAGE
self
.
url
=
url
if
url
else
self
.
DEFAULT_URL
# queues & default exchange declaration
self
.
connection
=
conn
self
.
connection
=
pika
.
BlockingConnection
(
pika
.
URLParameters
(
self
.
url
))
self
.
channel
=
self
.
connection
.
channel
()
self
.
services_queue_name
=
'services_queue@%s'
%
self
.
COMPONENT_ID
self
.
channel
.
queue_declare
(
queue
=
self
.
services_queue_name
,
...
...
@@ -756,7 +756,7 @@ if __name__ == '__main__':
cli
.
start
()
amqp_listener
=
AmqpSniffer
(
connection
,
AMQP_EXCHANGE
,
None
)
# if None subscribe to all messages
amqp_listener
=
AmqpSniffer
(
AMQP_URL
,
AMQP_EXCHANGE
,
[
'#'
]
)
# if None subscribe to all messages
amqp_listener
.
start
()
# interrumpted
...
...
Write
Preview
Markdown
is supported
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