Skip to content
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 5 publish properties #12678

Merged
merged 4 commits into from
Feb 16, 2023

Conversation

jlordiales
Copy link
Contributor

resolves: #12526

Add optional support for MQTT 5 publish properties in the config

solves: influxdata#12526

Add optional support for MQTT 5 publish properties in the config.
@telegraf-tiger telegraf-tiger bot added area/mqtt feat Improvement on an existing feature such as adding a new setting/mode to an existing plugin plugin/output 1. Request for new output plugins 2. Issues/PRs that are related to out plugins labels Feb 14, 2023
@serroba
Copy link
Contributor

serroba commented Feb 15, 2023

FYI @svagner
🙇

Copy link
Contributor

@powersj powersj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for taking the time to put this together! I have a couple of changes and comments in-line.

plugins/outputs/mqtt/README.md Outdated Show resolved Hide resolved
plugins/outputs/mqtt/sample.conf Outdated Show resolved Hide resolved
plugins/outputs/mqtt/mqtt_v5.go Outdated Show resolved Hide resolved
plugins/outputs/mqtt/mqtt_v5.go Outdated Show resolved Hide resolved
plugins/outputs/mqtt/mqtt_test.go Outdated Show resolved Hide resolved
@telegraf-tiger
Copy link
Contributor

Copy link
Contributor

@powersj powersj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank for the quick turn around!

@serroba you were the one who filed the feature request, could you give the artifacts in this PR a try and confirm they resolve your request?

@powersj powersj added the ready for final review This pull request has been reviewed and/or tested by multiple users and is ready for a final review. label Feb 15, 2023
@jlordiales
Copy link
Contributor Author

I've verified this is working as expected by having telegraf write to a local mosquitto instance.

With:

mosquitto_sub -F "Topic content type: %C,\n Message expiry: %E,\n User properties %P,\n Response topic: %R,\n %J" --protocol-version 5 -h mosquitto -p 1883 -t "<topic>"

and the new config properties:

[outputs.mqtt.v5]
  content_type = "application/json"
  response_topic = "test-response-topic"
  message_expiry = "10s"

[outputs.mqtt.v5.user_properties]
  "key1" = "value 1"
  "key2" = "value 2"

we get the expected values from the server:

Topic content type: application/json,
 Message expiry: 10,
 User properties key1:value 1 key2:value 2,
 Response topic: test-response-topic,
<payload>

@serroba and I work together :)

@serroba
Copy link
Contributor

serroba commented Feb 16, 2023

Thanks for checking with me @powersj
Yes, indeed, we work together.

Changes LGTM. Thanks a lot to both!

Copy link
Contributor

@srebhan srebhan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me. Thanks for the contribution @jlordiales!

@srebhan srebhan merged commit 8896538 into influxdata:master Feb 16, 2023
@srebhan srebhan added this to the v1.26.0 milestone Jun 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/mqtt feat Improvement on an existing feature such as adding a new setting/mode to an existing plugin plugin/output 1. Request for new output plugins 2. Issues/PRs that are related to out plugins ready for final review This pull request has been reviewed and/or tested by multiple users and is ready for a final review.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[outputs.mqtt] Extend support to native MQTT v5 protocol to the outgoing connection
4 participants