eventing icon indicating copy to clipboard operation
eventing copied to clipboard

Prototype a MQTT Source

Open ctmphuongg opened this issue 9 months ago • 6 comments

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)

  • Install packages for mqtt_paho
  • Prototype an mqtt container source

Notes: For testing

  1. MQTT needs a source to listen from. For local testing, run this command to open the mosquitto mqtt broker for source.
docker run -it --rm --name mosquitto -p 1883:1883 eclipse-mosquitto:2.0 mosquitto -c /mosquitto-no-auth.conf
  1. Keep the mqttsource running by go build the file and run
./main -source localhost:1883 -eventType mqtt.event -eventSource mqtt://localhost:1883 -topic "test-topic"
  1. Send a message to the same topic, using
mosquitto_pub -t 'test-topic' -m '{"specversion" : "1.0","type" :"com.example.someevent", "id" : "1234-1234-1234","source" : "/mycontext/subcontext","data":{"msg":"hello world!"}}' -D PUBLISH user-property Content-Type application/cloudevents+json; charset=utf-8
  1. The message will be logged and sent to sink.

ctmphuongg avatar May 10 '24 23:05 ctmphuongg

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 /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

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.

knative-prow[bot] avatar May 10 '24 23:05 knative-prow[bot]

Codecov Report

Attention: Patch coverage is 0% with 58 lines in your changes are missing coverage. Please review.

Project coverage is 69.26%. Comparing base (7e1c082) to head (ba1a157). Report is 65 commits behind head on main.

Files Patch % Lines
cmd/mqttsource/main.go 0.00% 58 Missing :warning:
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     

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

codecov[bot] avatar May 10 '24 23:05 codecov[bot]

/cc @matzew

Not sure if you have any initial feedback here...

Cali0707 avatar May 13 '24 19:05 Cali0707

/cc @Leo6Leo

ctmphuongg avatar May 14 '24 15:05 ctmphuongg

/ok-to-test

Leo6Leo avatar May 27 '24 22:05 Leo6Leo

Thanks for fixing the review comment! @ctmphuongg /lgtm /cc @pierDipi @creydr @Cali0707

Leo6Leo avatar May 28 '24 13:05 Leo6Leo

[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 /approve in a comment Approvers can cancel approval by writing /approve cancel in a comment

knative-prow[bot] avatar May 30 '24 18:05 knative-prow[bot]

Just add a blog post for this PR here! Knative Docs #6062

ctmphuongg avatar Jul 22 '24 02:07 ctmphuongg