Skip to content

feat(command): 3rd party command query via messaging#4135

Merged
lenny-goodell merged 2 commits intoedgexfoundry:mainfrom
chr1shung:issue-4078
Sep 9, 2022
Merged

feat(command): 3rd party command query via messaging#4135
lenny-goodell merged 2 commits intoedgexfoundry:mainfrom
chr1shung:issue-4078

Conversation

@chr1shung
Copy link
Copy Markdown

@chr1shung chr1shung commented Aug 29, 2022

allow core command to subscribe query request and publish
commands response to 3rd party requester with external MQTT

fix #4078

Signed-off-by: Chris Hung chris@iotechsys.com

If your build fails due to your commit message not passing the build checks, please review the guidelines here: https://github.com/edgexfoundry/edgex-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?)

Testing Instructions

  1. Run command service from this branch with MESSAGEQUEUE_REQUIRED=true environment variable
  2. send query request message to edgex/commandquery/request/<devicename> topic.
    For example send following message to edgex/commandquery/request/Random-Boolean-Device:
{
  "correlationID": "14a42ea6-c394-41c3-8bcd-a29b9f5e6835",
  "apiVersion": "v2",
  "requestId": "e6e8a2f4-eb14-4649-9e2b-175247911369",
}
  1. check the received message:
{
  "ReceivedTopic": "edgex/commandquery/request/Random-Boolean-Device",
  "CorrelationID": "14a42ea6-c394-41c3-8bcd-a29b9f5e6835",
  "ApiVersion": "v2",
  "RequestID": "e6e8a2f4-eb14-4649-9e2b-175247911369",
  "ErrorCode": 0,
  "Payload": "eyJkZXZpY2VOYW1lIjoiUmFuZG9tLUJvb2xlYW4tRGV2aWNlIiwicHJvZmlsZU5hbWUiOiJSYW5kb20tQm9vbGVhbi1EZXZpY2UiLCJjb3JlQ29tbWFuZHMiOlt7Im5hbWUiOiJXcml0ZUJvb2xWYWx1ZSIsInNldCI6dHJ1ZSwicGF0aCI6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LURldmljZS9Cb29sQXJyYXkiLCJ1cmwiOiJodHRwOi8vZWRnZXgtY29yZS1jb21tYW5kOjU5ODgyIiwicGFyYW1ldGVycyI6W3sicmVzb3VyY2VOYW1lIjoiQm9vbEFycmF5IiwidmFsdWVUeXBlIjoiQm9vbEFycmF5In1dfV19",
  "ContentType": "application/json",
  "QueryParams": null
}

New Dependency Instructions (If applicable)

@codecov-commenter
Copy link
Copy Markdown

Codecov Report

Merging #4135 (0970942) into main (5f565a5) will not change coverage.
The diff coverage is n/a.

@@           Coverage Diff           @@
##             main    #4135   +/-   ##
=======================================
  Coverage   43.65%   43.65%           
=======================================
  Files         121      121           
  Lines       10691    10691           
=======================================
  Hits         4667     4667           
  Misses       5624     5624           
  Partials      400      400           

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@chr1shung chr1shung marked this pull request as ready for review September 2, 2022 03:29
Copy link
Copy Markdown
Member

@lenny-goodell lenny-goodell left a comment

Choose a reason for hiding this comment

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

Missing unit tests.
You will need to run mockery against Client at https://github.com/eclipse/paho.mqtt.golang/tree/v1.4.1
and then copy the generated file into new mocks folder under the messaging folder.

Comment thread internal/core/command/controller/messaging/external/external.go
Comment thread internal/core/command/controller/messaging/external/external.go Outdated
Comment thread internal/core/command/controller/messaging/external/external.go
Comment thread internal/core/command/controller/messaging/external/external.go
Comment thread internal/core/command/controller/messaging/external/external.go Outdated
Comment thread internal/core/command/controller/messaging/external/external.go Outdated
Comment thread internal/core/command/controller/messaging/external/external.go Outdated
Chris Hung added 2 commits September 9, 2022 06:33
allow core command to subscribe query request and publish
commands response to 3rd party via external MQTT

Signed-off-by: Chris Hung <chris@iotechsys.com>
Signed-off-by: Chris Hung <chris@iotechsys.com>
@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud Bot commented Sep 8, 2022

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
No Duplication information No Duplication information

Copy link
Copy Markdown
Member

@lenny-goodell lenny-goodell 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 a0e04e5 into edgexfoundry:main Sep 9, 2022
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.

Core command subscribes to query requests and publishes query responses to 3rd party requester via messaging

3 participants