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: Add MQTT Will configuration for MQTT Export #1495

Merged
merged 1 commit into from
Oct 18, 2023

Conversation

lenny-goodell
Copy link
Member

closes #1117

If your build fails due to your commit message not passing the build checks, please review the guidelines here: https://github.com/edgexfoundry/app-functions-sdk-go/blob/main/.github/CONTRIBUTING.md

PR Checklist

Please check if your PR fulfills the following requirements:

  • I am not introducing a breaking change (if you are, flag in conventional commit message with BREAKING CHANGE: describing the break)
  • I am not introducing a new dependency (add notes below if you are)
  • I have added unit tests for the new feature or bug fix (if not, why?)
  • I have fully tested (add details below) this the new feature or bug fix (if not, why?)
  • I have opened a PR for the related docs change (if not, why?)
    TBD

Testing Instructions

run non-secure edgex as follows

 make run mqtt-broker mqtt-verbose no-secty ds-rest

Build ASC with this branch
Add the following to mqtt-export profile under MQTTExport.Parameters

          WillEnabled: "true"
          WillPayload: "goodbye"
          WillQos: "2"
          WillRetained: "true"
          WillTopic: "me/be/gone"

run ASC as follows

./app-service-configurable -d -o -cp -p=mqtt-export

Verify expected 5 Will parameters are in following log message

configurable pipeline with parameters: [secretname='mqtt', willqos='2', authmode='none', skipverify='false', brokeraddress='tcp://localhost:1883', clientid='MQTT-Export', persistonerror='false', willenabled='true', autoreconnect='false', willtopic='me/be/gone', connecttimeout='', retain='false', topic='edgex-export', willpayload='goodbye', willretained='true', qos='0', keepalive='']

Send data to Device Rest

curl -d "1234" -X POST localhost:59986/api/v3/resource/sample-numeric/int

Verify ASC logs contain the following:

msg="Last Will options set for MQTT Export: {Enabled:true Payload:goodbye Qos:2 Retained:true Topic:me/be/gone}"

Connect mqtt.FX to broker and subscribe to me/be/gone topic
Stop ASC
Verify mqtt.FX received new goodbye message on me/be/gone topic with QOS = 2

New Dependency Instructions (If applicable)

closes edgexfoundry#1117

Signed-off-by: Leonard Goodell <leonard.goodell@intel.com>
Copy link
Contributor

@ejlee3 ejlee3 left a comment

Choose a reason for hiding this comment

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

LGTM

@lenny-goodell lenny-goodell merged commit 03e14d6 into edgexfoundry:main Oct 18, 2023
3 checks passed
@lenny-goodell lenny-goodell deleted the mqtt-export-will branch October 18, 2023 19:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add ability to set MQTT Will options for external MQTT and MQTT export server connections
3 participants