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
519d40d8
Commit
519d40d8
authored
Sep 02, 2020
by
Manuel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
traceRetrieval: fixed messagehandler repository
parent
78d74fc2
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
7 deletions
+5
-7
main.py
...ansaction-hub-in/trace-retrieval-microservice/app/main.py
+2
-2
MessageHandler.py
...ce-retrieval-microservice/app/messaging/MessageHandler.py
+3
-5
No files found.
src/transaction-hub-in/trace-retrieval-microservice/app/main.py
View file @
519d40d8
...
@@ -19,12 +19,12 @@ import connexion
...
@@ -19,12 +19,12 @@ import connexion
from
security
import
swagger_util
from
security
import
swagger_util
from
env_info
import
is_running_locally
from
env_info
import
is_running_locally
from
database.
MongoRepository
import
Mongo
Repository
from
database.
repository
import
Repository
from
messaging.MessageHandler
import
MessageHandler
from
messaging.MessageHandler
import
MessageHandler
from
messaging.ReconnectingMessageManager
import
ReconnectingMessageManager
from
messaging.ReconnectingMessageManager
import
ReconnectingMessageManager
# init message handler
# init message handler
message_handler
=
MessageHandler
(
Mongo
Repository
(),
ReconnectingMessageManager
.
getInstance
())
message_handler
=
MessageHandler
(
Repository
(),
ReconnectingMessageManager
.
getInstance
())
def
message_received_callback
(
channel
,
method
,
properties
,
body
):
def
message_received_callback
(
channel
,
method
,
properties
,
body
):
message_handler
.
handle_generic
(
body
)
message_handler
.
handle_generic
(
body
)
...
...
src/transaction-hub-in/trace-retrieval-microservice/app/messaging/MessageHandler.py
View file @
519d40d8
...
@@ -21,8 +21,6 @@ class MessageHandler:
...
@@ -21,8 +21,6 @@ class MessageHandler:
_mongo_repo
=
None
_mongo_repo
=
None
_message_sender
=
None
_message_sender
=
None
_repository
=
Repository
()
def
__init__
(
self
,
mongo_repo
,
message_sender
):
def
__init__
(
self
,
mongo_repo
,
message_sender
):
self
.
_mongo_repo
=
mongo_repo
self
.
_mongo_repo
=
mongo_repo
self
.
_message_sender
=
message_sender
self
.
_message_sender
=
message_sender
...
@@ -153,7 +151,7 @@ class MessageHandler:
...
@@ -153,7 +151,7 @@ class MessageHandler:
if
"ApplicationType"
not
in
transaction_message
.
keys
():
if
"ApplicationType"
not
in
transaction_message
.
keys
():
LOGGER
.
error
(
"Transaction has no ApplicationType, storing it under use-case 'unknown'."
)
LOGGER
.
error
(
"Transaction has no ApplicationType, storing it under use-case 'unknown'."
)
transaction_message
[
"ApplicationType"
]
=
"unknown"
transaction_message
[
"ApplicationType"
]
=
"unknown"
MessageHandler
.
_repository
.
add_failed_transaction
(
transaction_message
)
self
.
_mongo_repo
.
add_failed_transaction
(
transaction_message
)
return
return
use_case
=
transaction_message
[
"ApplicationType"
]
use_case
=
transaction_message
[
"ApplicationType"
]
...
@@ -162,14 +160,14 @@ class MessageHandler:
...
@@ -162,14 +160,14 @@ class MessageHandler:
data
=
self
.
_fetch_schema_information
(
use_case
)
data
=
self
.
_fetch_schema_information
(
use_case
)
except
ValueError
as
e
:
except
ValueError
as
e
:
print
(
f
"{e}"
)
print
(
f
"{e}"
)
MessageHandler
.
_repository
.
add_failed_transaction
(
transaction_message
)
self
.
_mongo_repo
.
add_failed_transaction
(
transaction_message
)
return
return
mappings
=
data
[
"mappings"
]
mappings
=
data
[
"mappings"
]
flattened
=
self
.
_flatten_transaction
(
transaction_message
,
mappings
)
flattened
=
self
.
_flatten_transaction
(
transaction_message
,
mappings
)
transaction
=
Transaction
(
use_case
,
flattened
)
transaction
=
Transaction
(
use_case
,
flattened
)
MessageHandler
.
_repository
.
add_transaction
(
transaction
)
self
.
_mongo_repo
.
add_transaction
(
transaction
)
msg
=
{
msg
=
{
"type"
:
"new-trace"
,
"type"
:
"new-trace"
,
...
...
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