-
Notifications
You must be signed in to change notification settings - Fork 5.6k
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
feat(outputs.mqtt): Add support for MQTT protocol version 5 #11284
feat(outputs.mqtt): Add support for MQTT protocol version 5 #11284
Conversation
github.com/eclipse/paho.mqtt.golang
with githubcom/eclipse/paho.golang
github.com/eclipse/paho.mqtt.golang
with github.com/eclipse/paho.golang
github.com/eclipse/paho.mqtt.golang
with github.com/eclipse/paho.golang
github.com/eclipse/paho.mqtt.golang
with github.com/eclipse/paho.golang
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.
Looks mostly good. Thanks for your submission @cmackenzie1! I do have some small suggestions. Can you please take a look?
@srebhan upon digging into the Thoughts on using both the new and old libraries and adding a field |
@cmackenzie1 do you know if the paho guys are planning to support both in one library? The setting might be an oversight or something... If this is not an issue they want to fix, we should indeed look into supporting both libraries with a |
@srebhan - just created eclipse-paho/paho.golang#89 to see what the status is. There is no clear answer in the docs from what I can tell. |
Note that the v5 package does not yet support persistence (this negates the point of QOS1/2). As per the response on the issue raised on |
@cmackenzie1 so you need to go with both versions then? |
@srebhan I think so. I'll try and work on the PR this week during my downtime. |
@cmackenzie1 any update on this PR? |
Apologies @srebhan - I've been on a mix of vacation and being sick. Did you want me to close the PR for now until I get some time to work on it? |
@srebhan I managed to get some time this afternoon to work on the change to support multiple clients. Ready for a review at your leisure! |
github.com/eclipse/paho.mqtt.golang
with github.com/eclipse/paho.golang
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.
Thanks for taking time to update this PR @cmackenzie1! I didn't mean to urge your with this, I just wanted to make sure this PR is not forgotten. :-)
The code looks nice and clean. Just some minor comments. One thing that would be nice is if you can add an integration test for version 5 similar to what is there for v3 as I think this is not covered currently....
@srebhan no worries, I addressed those comments and even switched the test docker image over to use the official image from Eclipse. |
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.
That looks very good @cmackenzie1. Thanks for your quick update. I only have one more comment regarding your tests. I suggest to put the server configuration to a file and ship it instead of temporary file creation. That will save a lot of trouble and code. :-)
Oh and please rebase to latest master as something strange happend to the CI tests. I'm pretty sure that you need to add |
Rebased, updated to include a |
@cmackenzie1 it also seems like you need to run |
@srebhan ran |
Yeah |
@srebhan I think I addressed them already, unless they are still in "pending" on your end. |
Oh boy, forgot to submit my review.... ;-) |
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 @cmackenzie1, sorry forgot to submit the review... Just two more comments for the test-cases and we are good to go from my side...
By refactoring into versioned clients and adding `github.com/eclipse/paho.golang`, the MQTT output plugin can now support MQTT protocols `3.1.1` and `5`, with the default remaining `3.1.1` Other notable changes: - The list of servers in the config can now be prefixed with a scheme (ie, `mqtt://` or `mqtts://`), with the default being `tcp://` if not present to maintain original behavior. - The write timeout is for protocol `5` client is done using `context.WithTimeout`. - `MQTT` config was reordered to group similar properties together and `toml` tags were added for all exported fields. - `MQTT` integration tests were switched to the official [`eclipse-mosquitto`](https://hub.docker.com/_/eclipse-mosquitto) docker image
@srebhan no worries! I addressed those two comments and rebased onto the latest |
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.
Perfect. Thank you @cmackenzie1 for all your effort!
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.
Thank you so much for adding this!
Required for all PRs:
Summary
By refactoring into versioned clients and adding
github.com/eclipse/paho.golang
, the MQTT output plugin can now support MQTT protocols3.1.1
and5
, with the default remaining3.1.1
Other notable changes:
mqtt://
ormqtts://
), with the default beingtcp://
if not present to maintain original behavior.5
client is done usingcontext.WithTimeout
.MQTT
config was reordered to group similar properties together andtoml
tags were added for all exported fields.