Skip to content

feat: Implement Device Service System Events#4351

Merged
lenny-goodell merged 1 commit intoedgexfoundry:mainfrom
jinlinGuan:issue-4328
Feb 15, 2023
Merged

feat: Implement Device Service System Events#4351
lenny-goodell merged 1 commit intoedgexfoundry:mainfrom
jinlinGuan:issue-4328

Conversation

@jinlinGuan
Copy link
Contributor

  • publish system events for device service add/update/delete
  • remove the REST callback

close #4328

Signed-off-by: Ginny Guan ginny@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?)
    feat: Update Core Metadata Device System Event DTO edgex-docs#960

Testing Instructions

  1. build and run core-metadata with other services
  2. find the correct logs
  3. (optional) subscribe the redis messagebus system event topic and receive the correct messages
  • add a device service
level=DEBUG ts=2023-02-14T09:40:28.565100915Z app=core-metadata source=deviceservice.go:38 msg="DeviceService created on DB successfully. DeviceService ID: 138b3b44-c498-4949-adeb-310348c870d7, Correlation-ID: 91a6ba03-3cd1-4607-99bb-a3e5d2947750 "
level=DEBUG ts=2023-02-14T09:40:28.565476072Z app=core-metadata source=notify.go:214 msg="Published the 'add' System Event for deviceservice 'device-simple' to topic 'edgex/system-events/core-metadata/deviceservice/add/device-simple'"
  • update a device service
level=DEBUG ts=2023-02-14T09:41:10.815970347Z app=core-metadata source=deviceservice.go:79 msg="DeviceService patched on DB successfully. Correlation-ID: a399a5ae-b6af-42ce-a0f7-ad40f33c7240 "
level=DEBUG ts=2023-02-14T09:41:10.816261428Z app=core-metadata source=notify.go:214 msg="Published the 'update' System Event for deviceservice 'device-simple' to topic 'edgex/system-events/core-metadata/deviceservice/update/device-simple'"
  • delete a device service
level=DEBUG ts=2023-02-14T09:51:43.363771923Z app=core-metadata source=notify.go:214 msg="Published the 'delete' System Event for deviceservice 'device-simple' to topic 'edgex/system-events/core-metadata/deviceservice/delete/device-simple'"

New Dependency Instructions (If applicable)

@jinlinGuan
Copy link
Contributor Author

fix the conflicts in notify.go, and use common.BuildTopic instead of fmt.Sprintf for the publishTopic

@cloudxxx8
Copy link
Member

the unit test is failed
please update the mock

- publish system events for device service add/update/delete
- remove the REST callback

close edgexfoundry#4328

Signed-off-by: Ginny Guan <ginny@iotechsys.com>
@sonarqubecloud
Copy link

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 1 Code Smell

No Coverage information No Coverage information
3.2% 3.2% Duplication

@jinlinGuan
Copy link
Contributor Author

the unit test is failed please update the mock

fixed

@codecov-commenter
Copy link

Codecov Report

Merging #4351 (24acf51) into main (788be75) will increase coverage by 0.02%.
The diff coverage is 28.57%.

📣 This organization is not using Codecov’s GitHub App Integration. We recommend you install it so Codecov can continue to function properly for your repositories. Learn more

@@            Coverage Diff             @@
##             main    #4351      +/-   ##
==========================================
+ Coverage   43.67%   43.70%   +0.02%     
==========================================
  Files         116      116              
  Lines       10710    10715       +5     
==========================================
+ Hits         4678     4683       +5     
  Misses       5612     5612              
  Partials      420      420              
Impacted Files Coverage Δ
...nternal/core/metadata/application/deviceservice.go 0.00% <0.00%> (ø)
internal/core/metadata/application/notify.go 40.21% <54.54%> (+6.53%) ⬆️

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

Copy link
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 96713c0 into edgexfoundry:main Feb 15, 2023
@jinlinGuan jinlinGuan deleted the issue-4328 branch February 16, 2023 03:31
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.

Replace device service callbacks with system events

4 participants