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 ability to wrap data into an event #1154

Merged
merged 3 commits into from
Jul 19, 2022

Conversation

ejlee3
Copy link
Contributor

@ejlee3 ejlee3 commented Jul 15, 2022

closes #1149

Signed-off-by: Elizabeth J Lee elizabeth.j.lee@intel.com

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?)
    feat: docs for built-in pipeline function to wrap event edgex-docs#799

Testing Instructions

  1. run the base edgex components
  2. set the following changes in the sample profile
    [Writable.Pipeline]
    ExecutionOrder = "Compress, WrapIntoEvent, SetResponseData"
    ...
    [Writable.Pipeline.Functions.WrapIntoEvent]
      [Writable.Pipeline.Functions.WrapIntoEvent.Parameters]
      ProfileName = "MyProfile"
      DeviceName = "MyDevice"
      ResourceName = "XMLEvent"
      ValueType = "String"
      MediaType = ""  # Required only when ValueType=Binary
    ...
    [Trigger.EdgexMessageBus.SubscribeHost]
    Host = "localhost"
    Port = 6379
    Protocol = "redis"
    SubscribeTopics="edgex/events/device/Random-Boolean-Device/#"
    [Trigger.EdgexMessageBus.PublishHost]
    Host = "localhost"
    Port = 6379
    Protocol = "redis"
    PublishTopic="edgex/events/device/{profilename}/{devicename}/{sourcename}"
    
  3. build and run the sample profile
  4. wait for the data to come through
  5. check this endpoint for the event info localhost:59880/api/v2/event/device/name/MyDevice

New Dependency Instructions (If applicable)

closes edgexfoundry#1149

Signed-off-by: Elizabeth J Lee <elizabeth.j.lee@intel.com>
AlexCuse
AlexCuse previously approved these changes Jul 17, 2022
Copy link
Contributor

@AlexCuse AlexCuse left a comment

Choose a reason for hiding this comment

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

Lgtm just saw one typo in comment

internal/app/configurable.go Outdated Show resolved Hide resolved
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.

Nice Job! A few minor issues.

internal/app/configurable.go Outdated Show resolved Hide resolved
internal/app/configurable.go Outdated Show resolved Hide resolved
pkg/transforms/event.go Outdated Show resolved Hide resolved
pkg/transforms/event.go Outdated Show resolved Hide resolved
pkg/transforms/event.go Outdated Show resolved Hide resolved
pkg/transforms/event.go Outdated Show resolved Hide resolved
pkg/transforms/event_test.go Outdated Show resolved Hide resolved
pkg/transforms/event_test.go Outdated Show resolved Hide resolved
Signed-off-by: Elizabeth J Lee <elizabeth.j.lee@intel.com>
internal/app/configurable.go Outdated Show resolved Hide resolved
Signed-off-by: Elizabeth J Lee <elizabeth.j.lee@intel.com>
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, THX!

@lenny-goodell lenny-goodell merged commit 13a0e4a into edgexfoundry:main Jul 19, 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.

Add pipeline function to wrap raw data from previous function into an Event/Reading
3 participants