-
Notifications
You must be signed in to change notification settings - Fork 600
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
Prototype a MQTT Source #7919
Prototype a MQTT Source #7919
Conversation
Hi @ctmphuongg. Thanks for your PR. I'm waiting for a knative member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #7919 +/- ##
==========================================
+ Coverage 69.22% 69.26% +0.04%
==========================================
Files 339 345 +6
Lines 19494 16052 -3442
==========================================
- Hits 13494 11119 -2375
+ Misses 5337 4247 -1090
- Partials 663 686 +23 ☔ View full report in Codecov by Sentry. |
/cc @matzew Not sure if you have any initial feedback here... |
/cc @Leo6Leo |
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.
Great job @ctmphuongg ! The PR looks great overall, and I have tested it locally, everything works perfectly.
Currently the CI is failing due to the check failure on codegen. Please run
./hack/update-codegen.sh
to fix the problem!
/ok-to-test |
Thanks for fixing the review comment! @ctmphuongg |
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.
Hey @ctmphuongg awesome start! I left a few comments regarding error handling/setting CE attribute properly.
Otherwise, we generally use camel case variable names, not snake case in Knative. So, I went through and suggested a new variable name on the first occurrence of each variable I saw that was snake case. I would recommend going through and renaming those in your IDE instead of just committing my suggestions, as I didn't actually correct every instance of the variables, just the first
cmd/mqttsource/main.go
Outdated
newEvent.SetType(eventType) | ||
newEvent.SetSource(eventSource) | ||
newEvent.SetID(event.ID()) | ||
_ = newEvent.SetData(cloudevents.ApplicationJSON, data) |
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.
We should probably handle the error here, if we fail to set the data does it make sense to dispatch the event?
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.
I'll probably just log the error and return so the event would not be sent?
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
/approve
Thanks for working on this @ctmphuongg !!
If you're interested, I think the next steps for this feature would be to:
- Add some docs to explain how to deploy it/use it
- Write a blog post about the feature
Let me know if you're interested in this/would like any help!
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: Cali0707, ctmphuongg The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Just add a blog post for this PR here! Knative Docs #6062 |
Fixes #7207
Proposed Changes
(The main working files are cmd/mqttsource/main.go, config/tools/mqttsource/mqttsource.yaml, the rest is packages installed to use mqtt_paho, generated by using go get paho and go mod vendor)
Notes: For testing
./main -source localhost:1883 -eventType mqtt.event -eventSource mqtt://localhost:1883 -topic "test-topic"