-
Notifications
You must be signed in to change notification settings - Fork 55
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: split c8y JSON over MQTT messages using newline delimiter #3302
fix: split c8y JSON over MQTT messages using newline delimiter #3302
Conversation
This reverts commit 6748f0e.
\n
Instead of using a function made for splitting smartrest, just split on \n since that function will unescape \" sequences which we want to do in smartrest but avoid in JSON over MQTT. Signed-off-by: Marcel Guzik <[email protected]>
b92b458
to
9eee7ce
Compare
\n
Robot Results
|
Codecov ReportAttention: Patch coverage is Additional details and impacted files📢 Thoughts on this report? Let us know! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Given the nature of this PR I also verified it end-to-end just to be sure it works as expected. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Approved
// JSON over MQTT messages on c8y/devicecontrol/notifications can contain multiple operations in a single MQTT | ||
// message, so split them | ||
let operation_payloads = collect_c8y_messages(message.payload_str()?); | ||
let operation_payloads = message.payload_str()?.lines(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay - assuming that Cumulocity emits a batch of messages using JSON lines. A point I fail to find in Cumulocity docs.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unfortunately I don't think this is publicly documented.
Proposed changes
#3301 was wrong: using a function meant for splitting Smartrest will mess up JSON over MQTT since that function will unescape " sequences which we want to do in Smartrest but avoid in JSON over MQTT. This PR undoes this function's rename and uses regular line splitting for JSON over MQTT.
Types of changes
Paste Link to the issue
Checklist
cargo fmt
as mentioned in CODING_GUIDELINEScargo clippy
as mentioned in CODING_GUIDELINESFurther comments