Commit ee789e29 authored by Alexander Lercher's avatar Alexander Lercher

Workaround for MessageSender Error

parent d6ec9dd5
...@@ -39,4 +39,4 @@ class MessageHandler: ...@@ -39,4 +39,4 @@ class MessageHandler:
traces = response.json() traces = response.json()
self._processor.process(traces) self._processor.process(traces)
else: else:
LOGGER.error(f"Could not retrieve JSON from {url} with GET request") LOGGER.error(f"Could not retrieve JSON from {url} with GET request ({response.status_code})")
...@@ -2,16 +2,22 @@ from flask import request, Response ...@@ -2,16 +2,22 @@ from flask import request, Response
from messaging.MessageSender import MessageSender from messaging.MessageSender import MessageSender
import json import json
message_sender = MessageSender()
message_sender.connect()
message_sender.create_exchange('inhub', 'direct')
def receive(): def receive():
body = request.json body = request.json
if isBlockchainTraceValid(body): if isBlockchainTraceValid(body):
# TODO remove workaround
message_sender = MessageSender()
message_sender.connect()
message_sender.create_exchange('inhub', 'direct')
message = {'type': 'blockchain-transaction', 'content': body} message = {'type': 'blockchain-transaction', 'content': body}
message_sender.send('inhub', json.dumps(message), 'trace-retrieval') message_sender.send('inhub', json.dumps(message), 'trace-retrieval')
message_sender.disconnect()
return Response(status=201) return Response(status=201)
return Response(status=400) return Response(status=400)
......
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