Commit 72cf9efd authored by Alexander Lercher's avatar Alexander Lercher

Trace Retrieval: message handling with working json parser

parent fd3515f4
...@@ -81,6 +81,9 @@ class MessageReceiver: ...@@ -81,6 +81,9 @@ class MessageReceiver:
def stop(self): def stop(self):
'''Stops listening for messages and closes the connection''' '''Stops listening for messages and closes the connection'''
self._connection.ioloop.stop() try:
self._connection.close() self._connection.ioloop.stop()
LOGGER.info(f"RabbitMQ connection closed") self._connection.close()
\ No newline at end of file LOGGER.info("RabbitMQ connection closed")
except pika.exceptions.ConnectionWrongStateError:
LOGGER.warning("RabbitMQ connection already closed")
...@@ -25,7 +25,7 @@ class MessageHandler: ...@@ -25,7 +25,7 @@ class MessageHandler:
return return
if message['type'] == 'blockchain-transaction': if message['type'] == 'blockchain-transaction':
self.handle_blockchain_transaction(json.loads(message['content'])) self.handle_blockchain_transaction(message['content'])
def handle_blockchain_transaction(self, transaction): def handle_blockchain_transaction(self, transaction):
self._mongo_repo.insert_trace(transaction) self._mongo_repo.insert_trace(transaction)
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