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: Upgrade all advanced App Service examples to V3 #195

Merged
merged 1 commit into from
May 3, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
.PHONY: build clean

GO=CGO_ENABLED=1 GO111MODULE=on go

build:
go mod tidy
$(GO) build -o app-service
go build -o app-service

clean:
rm -f app-service
Original file line number Diff line number Diff line change
Expand Up @@ -14,48 +14,41 @@ The end result from this application service is random float values in human rea
Using the following setup, this example advanced **App Functions Service** can be used to demonstrate an EdgeX end to end proof point with **App Functions**.

1. Start **EdgeX** stack

- [ ] download Ireland non-secure compose file from [here](https://github.com/edgexfoundry/edgex-compose/blob/ireland/docker-compose-no-secty.yml)
TODO: Update link to `minnesota` branch
- [ ] download non-secure compose file from [here](https://github.com/edgexfoundry/edgex-compose/blob/main/docker-compose-no-secty.yml)

- [ ] start edgex which includes Device Virtual

```
docker-compose -p edgex -f docker-no-secty.yml up -d
docker-compose -p edgex -f docker-compose-no-secty.yml up -d
```

2. Build & run **Advanced App Functions** example

- [ ] Clone this **[Examples](https://github.com/edgexfoundry/edgex-examples)** repo
- [ ] cd to **application-services/custom/advanced-filter-convert-publish** folder
- [ ] run "**make build**"
- [ ] run "./**app-service**"
- [ ] run "./**app-service -cp -d -o **" (uses Config provider from common config, runs in dev mode for hybrid deployment and overwrite config in Config Provider)

3. Configure and Run **Simple Filter XML** example

- [ ] cd **application-services/custom/simple-filter-xml** folder

- [ ] edit **res/configuration.toml** so the **Port** and **SubscribeTopics** sections are as follows:
- [ ] edit **res/configuration.yaml** so the **Port** and **SubscribeTopics** sections are as follows:

```toml
[Service]
HealthCheckInterval = "10s"
Host = "localhost"
Port = 59781 <= Change to avoid conflict
```yaml
Service:
Host: "localhost"
Port: 59781 <= Change to avoid conflict

[Trigger]
Type="edgex-messagebus"
[Trigger.EdgexMessageBus]
Type = "redis"
[Trigger.EdgexMessageBus.SubscribeHost]
Host = "localhost"
Port = 6379
Protocol = "redis"
SubscribeTopics="converted" <= Change so receives Events from this example
Trigger:
PublishTopic: "" # Not publishing
SubscribeTopics: "converted" <= Change so receives Events from this example
```

- [ ] run "**make build**"

- [ ] run "./**app-service**"
- [ ] run "./**app-service -cp -d -o**"

4. Now data will be flowing due to the auto-events configured in Device Virtual.

Expand All @@ -68,5 +61,5 @@ Using the following setup, this example advanced **App Functions Service** can b

- In the terminal that you ran **simple-filter-xml** you will see the xml representation of the events printed. Note the human readable float values in the event XML.
```xml
<Event><ApiVersion>v2</ApiVersion><Id>8dc2ee9e-7824-4e57-a4a9-6ceb21229126</Id><DeviceName>Random-Float-Device</DeviceName><ProfileName>MyProfile</ProfileName><SourceName>MySource</SourceName><Origin>1626300284231075300</Origin><Readings><Id>1c1f399b-7cdd-47e8-9bbc-22efe0798ad0</Id><Origin>1626300284231075300</Origin><DeviceName>Random-Float-Device</DeviceName><ResourceName>Float64</ResourceName><ProfileName>Random-Float-Device</ProfileName><ValueType>Float64</ValueType><BinaryValue></BinaryValue><MediaType></MediaType><Value>2.1742</Value></Readings></Event>
<Event><ApiVersion>v3</ApiVersion><Id>8dc2ee9e-7824-4e57-a4a9-6ceb21229126</Id><DeviceName>Random-Float-Device</DeviceName><ProfileName>MyProfile</ProfileName><SourceName>MySource</SourceName><Origin>1626300284231075300</Origin><Readings><Id>1c1f399b-7cdd-47e8-9bbc-22efe0798ad0</Id><Origin>1626300284231075300</Origin><DeviceName>Random-Float-Device</DeviceName><ResourceName>Float64</ResourceName><ProfileName>Random-Float-Device</ProfileName><ValueType>Float64</ValueType><BinaryValue></BinaryValue><MediaType></MediaType><Value>2.1742</Value></Readings></Event>
```
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ import (
"errors"
"strconv"

"github.com/edgexfoundry/app-functions-sdk-go/v2/pkg/interfaces"
"github.com/edgexfoundry/go-mod-core-contracts/v2/dtos"
"github.com/edgexfoundry/app-functions-sdk-go/v3/pkg/interfaces"
"github.com/edgexfoundry/go-mod-core-contracts/v3/dtos"
)

const precision = 4
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ import (
"errors"
"fmt"

"github.com/edgexfoundry/app-functions-sdk-go/v2/pkg/interfaces"
"github.com/edgexfoundry/go-mod-core-contracts/v2/dtos"
"github.com/edgexfoundry/app-functions-sdk-go/v3/pkg/interfaces"
"github.com/edgexfoundry/go-mod-core-contracts/v3/dtos"
)

func PrintFloatValuesToConsole(ctx interfaces.AppFunctionContext, data interface{}) (bool, interface{}) {
Expand Down
68 changes: 34 additions & 34 deletions application-services/custom/advanced-filter-convert-publish/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,68 +3,68 @@ module advanced-filter-convert-publish
go 1.18

require (
github.com/edgexfoundry/app-functions-sdk-go/v2 v2.3.0
github.com/edgexfoundry/go-mod-core-contracts/v2 v2.3.0
github.com/edgexfoundry/app-functions-sdk-go/v3 v3.0.0-dev.59
github.com/edgexfoundry/go-mod-core-contracts/v3 v3.0.0-dev.39
)

require (
bitbucket.org/bertimus9/systemstat v0.5.0 // indirect
github.com/Microsoft/go-winio v0.5.2 // indirect
github.com/Microsoft/go-winio v0.6.0 // indirect
github.com/armon/go-metrics v0.3.10 // indirect
github.com/cenkalti/backoff v2.2.1+incompatible // indirect
github.com/diegoholiveira/jsonlogic/v3 v3.2.6 // indirect
github.com/eclipse/paho.mqtt.golang v1.4.1 // indirect
github.com/edgexfoundry/go-mod-bootstrap/v2 v2.3.0 // indirect
github.com/edgexfoundry/go-mod-configuration/v2 v2.3.0 // indirect
github.com/edgexfoundry/go-mod-messaging/v2 v2.3.0 // indirect
github.com/edgexfoundry/go-mod-registry/v2 v2.3.0 // indirect
github.com/edgexfoundry/go-mod-secrets/v2 v2.3.0 // indirect
github.com/diegoholiveira/jsonlogic/v3 v3.2.7 // indirect
github.com/eclipse/paho.mqtt.golang v1.4.2 // indirect
github.com/edgexfoundry/go-mod-bootstrap/v3 v3.0.0-dev.79 // indirect
github.com/edgexfoundry/go-mod-configuration/v3 v3.0.0-dev.10 // indirect
github.com/edgexfoundry/go-mod-messaging/v3 v3.0.0-dev.28 // indirect
github.com/edgexfoundry/go-mod-registry/v3 v3.0.0-dev.7 // indirect
github.com/edgexfoundry/go-mod-secrets/v3 v3.0.0-dev.14 // indirect
github.com/fatih/color v1.9.0 // indirect
github.com/fxamacker/cbor/v2 v2.4.0 // indirect
github.com/go-jose/go-jose/v3 v3.0.0 // indirect
github.com/go-kit/log v0.2.1 // indirect
github.com/go-logfmt/logfmt v0.5.1 // indirect
github.com/go-playground/locales v0.14.0 // indirect
github.com/go-playground/universal-translator v0.18.0 // indirect
github.com/go-playground/validator/v10 v10.11.1 // indirect
github.com/go-playground/locales v0.14.1 // indirect
github.com/go-playground/universal-translator v0.18.1 // indirect
github.com/go-playground/validator/v10 v10.13.0 // indirect
github.com/go-redis/redis/v7 v7.3.0 // indirect
github.com/golang/protobuf v1.5.2 // indirect
github.com/gomodule/redigo v1.8.9 // indirect
github.com/google/uuid v1.3.0 // indirect
github.com/gorilla/mux v1.8.0 // indirect
github.com/gorilla/websocket v1.4.2 // indirect
github.com/hashicorp/consul/api v1.15.3 // indirect
github.com/hashicorp/consul/api v1.20.0 // indirect
github.com/hashicorp/errwrap v1.0.0 // indirect
github.com/hashicorp/go-cleanhttp v0.5.1 // indirect
github.com/hashicorp/go-hclog v0.14.1 // indirect
github.com/hashicorp/go-immutable-radix v1.3.0 // indirect
github.com/hashicorp/go-multierror v1.1.1 // indirect
github.com/hashicorp/go-rootcerts v1.0.2 // indirect
github.com/hashicorp/golang-lru v0.5.4 // indirect
github.com/hashicorp/serf v0.9.7 // indirect
github.com/leodido/go-urn v1.2.1 // indirect
github.com/hashicorp/serf v0.10.1 // indirect
github.com/leodido/go-urn v1.2.3 // indirect
github.com/mattn/go-colorable v0.1.12 // indirect
github.com/mattn/go-isatty v0.0.14 // indirect
github.com/mitchellh/consulstructure v0.0.0-20190329231841-56fdc4d2da54 // indirect
github.com/mitchellh/copystructure v1.0.0 // indirect
github.com/mitchellh/copystructure v1.2.0 // indirect
github.com/mitchellh/go-homedir v1.1.0 // indirect
github.com/mitchellh/mapstructure v1.5.0 // indirect
github.com/mitchellh/reflectwalk v1.0.0 // indirect
github.com/nats-io/nats.go v1.18.0 // indirect
github.com/nats-io/nkeys v0.3.0 // indirect
github.com/mitchellh/reflectwalk v1.0.2 // indirect
github.com/nats-io/nats.go v1.25.0 // indirect
github.com/nats-io/nkeys v0.4.4 // indirect
github.com/nats-io/nuid v1.0.1 // indirect
github.com/pebbe/zmq4 v1.2.7 // indirect
github.com/pelletier/go-toml v1.9.5 // indirect
github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475 // indirect
github.com/spiffe/go-spiffe/v2 v2.1.1 // indirect
github.com/spiffe/go-spiffe/v2 v2.1.4 // indirect
github.com/x448/float16 v0.8.4 // indirect
github.com/zeebo/errs v1.2.2 // indirect
golang.org/x/crypto v0.0.0-20221010152910-d6f0a8c073c2 // indirect
golang.org/x/net v0.0.0-20211216030914-fe4d6282115f // indirect
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c // indirect
golang.org/x/sys v0.0.0-20221010170243-090e33056c14 // indirect
golang.org/x/text v0.3.7 // indirect
google.golang.org/genproto v0.0.0-20211208223120-3a66f561d7aa // indirect
google.golang.org/grpc v1.46.0 // indirect
google.golang.org/protobuf v1.28.0 // indirect
gopkg.in/square/go-jose.v2 v2.4.1 // indirect
github.com/zeebo/errs v1.3.0 // indirect
golang.org/x/crypto v0.8.0 // indirect
golang.org/x/mod v0.8.0 // indirect
golang.org/x/net v0.9.0 // indirect
golang.org/x/sync v0.1.0 // indirect
golang.org/x/sys v0.7.0 // indirect
golang.org/x/text v0.9.0 // indirect
golang.org/x/tools v0.6.0 // indirect
google.golang.org/genproto v0.0.0-20230223222841-637eb2293923 // indirect
google.golang.org/grpc v1.53.0 // indirect
google.golang.org/protobuf v1.28.1 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)
Loading