Commit 519d40d8 authored by Manuel's avatar Manuel

traceRetrieval: fixed messagehandler repository

parent 78d74fc2
......@@ -19,12 +19,12 @@ import connexion
from security import swagger_util
from env_info import is_running_locally
from database.MongoRepository import MongoRepository
from database.repository import Repository
from messaging.MessageHandler import MessageHandler
from messaging.ReconnectingMessageManager import ReconnectingMessageManager
# init message handler
message_handler = MessageHandler(MongoRepository(), ReconnectingMessageManager.getInstance())
message_handler = MessageHandler(Repository(), ReconnectingMessageManager.getInstance())
def message_received_callback(channel, method, properties, body):
message_handler.handle_generic(body)
......
......@@ -21,8 +21,6 @@ class MessageHandler:
_mongo_repo = None
_message_sender = None
_repository = Repository()
def __init__(self, mongo_repo, message_sender):
self._mongo_repo = mongo_repo
self._message_sender = message_sender
......@@ -153,7 +151,7 @@ class MessageHandler:
if "ApplicationType" not in transaction_message.keys():
LOGGER.error("Transaction has no ApplicationType, storing it under use-case 'unknown'.")
transaction_message["ApplicationType"] = "unknown"
MessageHandler._repository.add_failed_transaction(transaction_message)
self._mongo_repo.add_failed_transaction(transaction_message)
return
use_case = transaction_message["ApplicationType"]
......@@ -162,14 +160,14 @@ class MessageHandler:
data = self._fetch_schema_information(use_case)
except ValueError as e:
print(f"{e}")
MessageHandler._repository.add_failed_transaction(transaction_message)
self._mongo_repo.add_failed_transaction(transaction_message)
return
mappings = data["mappings"]
flattened = self._flatten_transaction(transaction_message, mappings)
transaction = Transaction(use_case, flattened)
MessageHandler._repository.add_transaction(transaction)
self._mongo_repo.add_transaction(transaction)
msg = {
"type": "new-trace",
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment