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

Add MQTT Trigger #454

Closed
lenny-goodell opened this issue Aug 21, 2020 · 9 comments · Fixed by #498
Closed

Add MQTT Trigger #454

lenny-goodell opened this issue Aug 21, 2020 · 9 comments · Fixed by #498
Assignees
Labels
2-medium priority denoting issues with cross-cutting project impact app-services subsystem_affected for application services enhancement New feature or request hanoi Hanoi release
Milestone

Comments

@lenny-goodell
Copy link
Member

lenny-goodell commented Aug 21, 2020

This triggers function pipeline from data subscribed from MQTT Broker.

Will handle JSON or CBOR which are identified by the initial bytes in the data.

If ResponseTopic is provided in configuration, the results from the function pipeline (if any) are publish to the configured topic.

Secure connections will follow the same patter/options used for the MqttSecretSend used to export to an MQTT Broker.

@lenny-goodell lenny-goodell added the hold Intended for PRs we want to flag for ongoing review label Aug 21, 2020
@cloudxxx8
Copy link
Member

add @FelixTing for awareness

@FelixTing
Copy link
Member

FelixTing commented Aug 24, 2020

IMHO, the premise of this issue is whether we allow app-service to connect to an external MQTT broker?
Current app-funcitons-sdk use go-mod-messaging library to interact with message bus, so it already supports MQTT(https://github.com/edgexfoundry/go-mod-messaging/blob/master/messaging/factory.go#L42). But go-mod-messaging is for EdgeX internal use, it only accepts the message payload that can be unmarshaled to EdgeX MessageEnvelope(https://github.com/edgexfoundry/go-mod-messaging/blob/master/internal/pkg/mqtt/client.go#L192). This limitation restricts the opportunity for app-service to connect to an external message bus.

@lenny-goodell
Copy link
Member Author

@FelixTing , As you have pointed out, go-mod-messaging is for internal MessageBus.

For allowing incoming data from external MQTT, we need to handle it similar to the HTTP trigger but with secure connection similar to MQTTSecretSender for exporting data with a secure connection, i.e. the MQTT Trigger will also use the exclusive secrets for the secure connection.

@lenny-goodell
Copy link
Member Author

@FelixTing , What is the Use Case for receiving data from external broker? Are you sending Event/Readings or custom data type? What is the end goal of receiving this data?

@FelixTing
Copy link
Member

FelixTing commented Sep 1, 2020

@lenny-intel We tried to use app service to interact with AWS IoT Device Shadow. The initial thought is to use app service to subscribe to AWS IoT Device Shadow topics. When receiving messages, analyze the topic name and the payload(custom data) via a built-in or custom function to determine the action needs to be taken, such as calling core-command API to update device resource values.

@cloudxxx8
Copy link
Member

@lenny-intel we are finding another way to deal with the downstream request, so please feel free to close this issue if it is not the case app service designed for.

@lenny-goodell
Copy link
Member Author

When receiving messages, analyze the topic name and the payload(custom data) via a built-in or custom function to determine the action needs to be taken, such as calling core-command API

@FelixTing , @cloudxxx8 , This MQTT trigger seems appropriate for your use case when creating a custom App Service with custom function to operate on the custom data received from the external MQTT broker. The app-functions-sdk has the ability for a custom App Service to specify the TargetType for the incoming data, which can be your custom data type or simply raw data (i.e. []byte). We would add new Trigger configuration type of mqtt and new config section for the MQTT Trigger connection details (similar to MessageBus configuration). This MQTT Trigger configuration would follow the pattern used to config the MQTTSecretSender and use the exclusive SecrectProvider to get the secrets required for secure connection.

Does this make sense for your use case or is finding another way to deal with the downstream request better for you?

@cloudxxx8
Copy link
Member

Thanks, @lenny-intel , this would be very useful.

@lenny-goodell lenny-goodell removed the hold Intended for PRs we want to flag for ongoing review label Sep 2, 2020
@jpwhitemn
Copy link
Member

Implement similar to how HTTP trigger works (per @lenny-intel )

@lenny-goodell lenny-goodell added 2-medium priority denoting issues with cross-cutting project impact app-services subsystem_affected for application services hanoi Hanoi release labels Sep 18, 2020
@lenny-goodell lenny-goodell added this to the Hanoi milestone Sep 18, 2020
lenny-goodell referenced this issue in lenny-goodell/app-functions-sdk-go Sep 22, 2020
@lenny-goodell lenny-goodell linked a pull request Sep 22, 2020 that will close this issue
12 tasks
lenny-goodell referenced this issue in lenny-goodell/app-functions-sdk-go Sep 22, 2020
lenny-goodell referenced this issue in lenny-goodell/app-functions-sdk-go Sep 22, 2020
lenny-goodell referenced this issue in lenny-goodell/app-functions-sdk-go Sep 22, 2020
lenny-goodell referenced this issue in lenny-goodell/app-functions-sdk-go Sep 22, 2020
lenny-goodell referenced this issue in lenny-goodell/app-functions-sdk-go Sep 22, 2020
lenny-goodell referenced this issue in lenny-goodell/app-functions-sdk-go Sep 22, 2020
lenny-goodell referenced this issue in lenny-goodell/app-functions-sdk-go Sep 22, 2020
lenny-goodell referenced this issue in lenny-goodell/app-functions-sdk-go Sep 22, 2020
lenny-goodell referenced this issue in lenny-goodell/app-functions-sdk-go Sep 22, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
2-medium priority denoting issues with cross-cutting project impact app-services subsystem_affected for application services enhancement New feature or request hanoi Hanoi release
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants