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