Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
S
SMART
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
3
Issues
3
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
UNI-KLU
SMART
Commits
9e9c7065
Commit
9e9c7065
authored
Aug 20, 2019
by
Alexander Lercher
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Extracted network constants
parent
72cf9efd
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
21 additions
and
6 deletions
+21
-6
MessageReceiver.py
modules/messaging/MessageReceiver.py
+2
-1
MessageSender.py
modules/messaging/MessageSender.py
+2
-1
network_constants.py
modules/network_constants.py
+15
-0
read-mongo-db.py
tools/read-mongo-db.py
+0
-0
MongoRepository.py
...in/trace-retrieval-microservice/app/db/MongoRepository.py
+2
-4
No files found.
modules/messaging/MessageReceiver.py
View file @
9e9c7065
import
pika
import
functools
from
threading
import
Thread
import
network_constants
as
netconst
import
logging
LOGGER
=
logging
.
getLogger
(
__name__
)
...
...
@@ -18,7 +19,7 @@ class MessageReceiver:
_message_received_callback
=
None
_error_callback
=
None
def
__init__
(
self
,
exchange_name
=
'beacon'
,
exchange_type
=
'fanout'
,
rabbit_mq_ip
=
'143.205.173.36'
,
rabbit_mq_port
=
30302
,
queue_name
=
''
,
auto_ack
=
True
):
def
__init__
(
self
,
exchange_name
=
'beacon'
,
exchange_type
=
'fanout'
,
rabbit_mq_ip
=
netconst
.
RABBIT_MQ_HOSTNAME
,
rabbit_mq_port
=
netconst
.
RABBIT_MQ_PORT
,
queue_name
=
''
,
auto_ack
=
True
):
self
.
_exchange_name
=
exchange_name
self
.
_exchange_type
=
exchange_type
self
.
_rabbit_mq_ip
=
rabbit_mq_ip
...
...
modules/messaging/MessageSender.py
View file @
9e9c7065
import
pika
import
functools
from
threading
import
Thread
import
network_constants
as
netconst
import
logging
LOGGER
=
logging
.
getLogger
(
__name__
)
...
...
@@ -13,7 +14,7 @@ class MessageSender:
_connection
:
pika
.
BlockingConnection
=
None
_channel
:
pika
.
channel
.
Channel
=
None
def
__init__
(
self
,
rabbit_mq_ip
=
'rabbit-mq'
,
rabbit_mq_port
=
5672
):
def
__init__
(
self
,
rabbit_mq_ip
=
netconst
.
RABBIT_MQ_HOSTNAME
,
rabbit_mq_port
=
netconst
.
RABBIT_MQ_PORT
):
self
.
_rabbit_mq_ip
=
rabbit_mq_ip
self
.
_rabbit_mq_port
=
rabbit_mq_port
...
...
modules/network_constants.py
0 → 100644
View file @
9e9c7065
### inside k8s
RABBIT_MQ_HOSTNAME
=
'rabbit-mq'
RABBIT_MQ_PORT
=
5672
MONGO_DB_HOST
=
'trace-retrieval-db'
MONGO_DB_PORT
=
27017
### outside k8s
# HOST_IP = '143.205.173.36'
# RABBIT_MQ_HOSTNAME = HOST_IP
# RABBIT_MQ_PORT = 30302
# MONGO_DB_HOST = HOST_IP
# MONGO_DB_PORT = 30003
\ No newline at end of file
tools/
MongoRepository
.py
→
tools/
read-mongo-db
.py
View file @
9e9c7065
File moved
transaction-hub-in/trace-retrieval-microservice/app/db/MongoRepository.py
View file @
9e9c7065
import
pymongo
MONGO_DB_HOST
=
'trace-retrieval-db'
MONGO_DB_PORT
=
'27017'
import
network_constants
as
netconst
class
MongoRepository
:
# TODO extract to docker env var
...
...
@@ -12,7 +10,7 @@ class MongoRepository:
_mongo_client
:
pymongo
.
MongoClient
=
None
def
__init__
(
self
,
username
=
_username
,
password
=
_password
):
self
.
_mongo_client
=
pymongo
.
MongoClient
(
f
"mongodb://{username}:{password}@{
MONGO_DB_HOST}:{
MONGO_DB_PORT}/"
)
self
.
_mongo_client
=
pymongo
.
MongoClient
(
f
"mongodb://{username}:{password}@{
netconst.MONGO_DB_HOST}:{netconst.
MONGO_DB_PORT}/"
)
database
=
self
.
_mongo_client
[
'traceRetrievalDB'
]
self
.
_collection
=
database
[
'traces'
]
...
...
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