Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
KWH40
fml40-reference-implementation
Commits
50cdcbd4
Commit
50cdcbd4
authored
Mar 31, 2021
by
Jiahang Chen
Browse files
error handle by non-json formatted s3i messages
parent
2985e505
Pipeline
#438533
passed with stages
in 50 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
ml/thing.py
View file @
50cdcbd4
...
...
@@ -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
):
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment