Commit 50cdcbd4 authored by Jiahang Chen's avatar Jiahang Chen
Browse files

error handle by non-json formatted s3i messages

parent 2985e505
Pipeline #438533 passed with stages
in 50 seconds
......@@ -449,24 +449,27 @@ def __on_broker_callback(self, ch, method, properties, body):
pass
elif isinstance(body, int):
return
pass
elif isinstance(body, str):
return
pass
ch.basic_ack(method.delivery_tag)
message_type = body.get("messageType")
if message_type == "userMessage":
self.on_user_message(body)
elif message_type == "serviceRequest":
self.on_service_request(body)
elif message_type == "getValueRequest":
self.on_get_value_request(body)
elif message_type == "getValueReply":
self.on_get_value_reply(body)
elif message_type == "serviceReply":
self.on_service_reply(body)
else:
### TODO send user message reply back
self.broker.receiver.acknowledge_message(method.delivery_tag)
try:
message_type = body.get("messageType")
if message_type == "userMessage":
self.on_user_message(body)
elif message_type == "serviceRequest":
self.on_service_request(body)
elif message_type == "getValueRequest":
self.on_get_value_request(body)
elif message_type == "getValueReply":
self.on_get_value_reply(body)
elif message_type == "serviceReply":
self.on_service_reply(body)
else:
### TODO send user message reply back
pass
except AttributeError:
pass
def __send_message_to_broker(self, receiver_endpoints, msg):
......
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