edgexfoundry / app-functions-sdk-go

Owner: Applications WG
Apache License 2.0
44 stars 83 forks source link

Add ability to set MQTT Will options for external MQTT and MQTT export server connections #1117

Closed qingqingyuan01 closed 1 year ago

qingqingyuan01 commented 2 years ago

🚀 Feature Request I have a question: How to set will message when app-service connect external mqtt server. If we want to set will message when app-service connect external mqtt server, now it seems there is no way to do that by app-functions-sdk-go since ExternalMqttConfig and MQTTSecretConfig struct has no will number. However, the paho mqtt client's option has it.

Relevant Package This feature request is for app-functions-sdk-go about ExternalMqttConfig and MQTTSecretConfig struct.

Description If we want to set will message when app-service connect external mqtt server, now it seems there is no way to do that by app-functions-sdk-go since ExternalMqttConfig and MQTTSecretConfig struct has no will number. However, the paho mqtt client's option has it.

Describe the solution you'd like Add ability to set the MQTT Will options for the External MQTT trigger and MQTT Export function. These Will Options are:

For External MQTT trigger they can simply be add to the Trigger configuration and used if set.

For MQTT Export function:

lenny-goodell commented 2 years ago

@qingqingyuan01 , transferring to app-functions-sdk for now since this isn't an edgex-go issue.

lenny-goodell commented 2 years ago

@qingqingyuan01, are you trying to use the Will options for MQTT Export or External MQTT Trigger?

Please provide your Use Case to give use more background on the need for this enhancement.

lenny-goodell commented 2 years ago

Based on what I see here, you want to set the following Will options in configuration, correct? https://www.hivemq.com/blog/mqtt-essentials-part-9-last-will-and-testament

qingqingyuan01 commented 2 years ago

Based on what I see here, you want to set the following Will options in configuration, correct? https://www.hivemq.com/blog/mqtt-essentials-part-9-last-will-and-testament

  • WillEnabled
  • WillTopic
  • WillPayload
  • WillQos
  • WillRetained

Yes, if it can be set the above Will options in configuration is best. We want to use the last Will message to tell other clients that we're disconnected so that other client can do corresponding processing. And it seems the common function for mqtt protocol. So, do you have plans to enhance it?

lenny-goodell commented 2 years ago

We can put it on our backlog. If you need it sooner we always welcome contributions.

qingqingyuan01 commented 2 years ago

OK,I got it, thanks for your reply.