Skip to content

Commit

Permalink
fix: Update all doc links in app template to refer to version 2.2
Browse files Browse the repository at this point in the history
fixes #1104

Signed-off-by: Leonard Goodell <[email protected]>
  • Loading branch information
Leonard Goodell committed Apr 28, 2022
1 parent 8ff173f commit f279096
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 14 deletions.
2 changes: 1 addition & 1 deletion app-service-template/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

This folder contains a buildable/runnable template for a new custom application service based on the Pre-Release 2.x release of the App Functions SDK.

> **Note**: If you only need to use the built-in pipeline functions, then it is advisable that you use `App Service Configurable` rather then create a new custom application service. See [here](https://docs.edgexfoundry.org/1.3/microservices/application/AppServiceConfigurable/) for more details on `App Service Configurable`
> **Note**: If you only need to use the built-in pipeline functions, then it is advisable that you use `App Service Configurable` rather then create a new custom application service. See [here](https://docs.edgexfoundry.org/2.2/microservices/application/AppServiceConfigurable/) for more details on `App Service Configurable`
Follow the instructions below to create your new customer application service:

Expand Down
2 changes: 1 addition & 1 deletion app-service-template/config/configuration.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ package config

// This file contains example of custom configuration that can be loaded from the service's configuration.toml
// and/or the Configuration Provider, aka Consul (if enabled).
// For more details see https://docs.edgexfoundry.org/2.0/microservices/application/GeneralAppServiceConfig/#custom-configuration
// For more details see https://docs.edgexfoundry.org/2.2/microservices/application/GeneralAppServiceConfig/#custom-configuration
// TODO: Update this configuration as needed for you service's needs and remove this comment
// or remove this file if not using custom configuration.

Expand Down
6 changes: 3 additions & 3 deletions app-service-template/functions/sample.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,13 @@ type Sample struct {
}

// LogEventDetails is example of processing an Event and passing the original Event to next function in the pipeline
// For more details on the Context API got here: https://docs.edgexfoundry.org/1.3/microservices/application/ContextAPI/
// For more details on the Context API got here: https://docs.edgexfoundry.org/2.2/microservices/application/ContextAPI/
func (s *Sample) LogEventDetails(ctx interfaces.AppFunctionContext, data interface{}) (bool, interface{}) {
lc := ctx.LoggingClient()
lc.Debugf("LogEventDetails called in pipeline '%s'", ctx.PipelineId())

if data == nil {
// Go here for details on Error Handle: https://docs.edgexfoundry.org/1.3/microservices/application/ErrorHandling/
// Go here for details on Error Handle: https://docs.edgexfoundry.org/2.2/microservices/application/ErrorHandling/
return false, fmt.Errorf("function LogEventDetails in pipeline '%s': No Data Received", ctx.PipelineId())
}

Expand Down Expand Up @@ -162,7 +162,7 @@ func (s *Sample) OutputXML(ctx interfaces.AppFunctionContext, data interface{})

// This sends the XML as a response. i.e. publish for MessageBus/MQTT triggers as configured or
// HTTP response to for the HTTP Trigger
// For more details on the SetResponseData() function go here: https://docs.edgexfoundry.org/1.3/microservices/application/ContextAPI/#complete
// For more details on the SetResponseData() function go here: https://docs.edgexfoundry.org/2.2/microservices/application/ContextAPI/#complete
ctx.SetResponseData([]byte(xml))
ctx.SetResponseContentType(common.ContentTypeXML)

Expand Down
12 changes: 6 additions & 6 deletions app-service-template/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ type myApp struct {
}

func main() {
// TODO: See https://docs.edgexfoundry.org/2.0/microservices/application/ApplicationServices/
// TODO: See https://docs.edgexfoundry.org/2.2/microservices/application/ApplicationServices/
// for documentation on application services.
app := myApp{}
code := app.CreateAndRunAppService(serviceKey, pkg.NewAppService)
Expand All @@ -64,15 +64,15 @@ func (app *myApp) CreateAndRunAppService(serviceKey string, newServiceFactory fu

// TODO: Replace with retrieving your custom ApplicationSettings from configuration or
// remove if not using AppSetting configuration section.
// For more details see https://docs.edgexfoundry.org/2.0/microservices/application/GeneralAppServiceConfig/#application-settings
// For more details see https://docs.edgexfoundry.org/2.2/microservices/application/GeneralAppServiceConfig/#application-settings
deviceNames, err := app.service.GetAppSettingStrings("DeviceNames")
if err != nil {
app.lc.Errorf("failed to retrieve DeviceNames from configuration: %s", err.Error())
return -1
}

// More advance custom structured configuration can be defined and loaded as in this example.
// For more details see https://docs.edgexfoundry.org/2.0/microservices/application/GeneralAppServiceConfig/#custom-configuration
// For more details see https://docs.edgexfoundry.org/2.2/microservices/application/GeneralAppServiceConfig/#custom-configuration
// TODO: Change to use your service's custom configuration struct
// or remove if not using custom configuration capability
app.serviceConfig = &config.ServiceConfig{}
Expand All @@ -90,7 +90,7 @@ func (app *myApp) CreateAndRunAppService(serviceKey string, newServiceFactory fu

// Custom configuration can be 'writable' or a section of the configuration can be 'writable' when using
// the Configuration Provider, aka Consul.
// For more details see https://docs.edgexfoundry.org/2.0/microservices/application/GeneralAppServiceConfig/#writable-custom-configuration
// For more details see https://docs.edgexfoundry.org/2.2/microservices/application/GeneralAppServiceConfig/#writable-custom-configuration
// TODO: Remove if not using writable custom configuration
if err := app.service.ListenForCustomConfigChanges(&app.serviceConfig.AppCustom, "AppCustom", app.ProcessConfigUpdates); err != nil {
app.lc.Errorf("unable to watch custom writable configuration: %s", err.Error())
Expand All @@ -101,7 +101,7 @@ func (app *myApp) CreateAndRunAppService(serviceKey string, newServiceFactory fu

// TODO: Replace below functions with built in and/or your custom functions for your use case
// or remove if using Pipeline By Topics below.
// See https://docs.edgexfoundry.org/2.0/microservices/application/BuiltIn/ for list of built-in functions
// See https://docs.edgexfoundry.org/2.2/microservices/application/BuiltIn/ for list of built-in functions
err = app.service.SetDefaultFunctionsPipeline(
transforms.NewFilterFor(deviceNames).FilterByDeviceName,
sample.LogEventDetails,
Expand All @@ -120,7 +120,7 @@ func (app *myApp) CreateAndRunAppService(serviceKey string, newServiceFactory fu
// Core Data publishes to the 'edgex/events/core/<profile-name>/<device-name>/<source-name>' topic
// Note: This example with default above causes Events from Random-Float-Device device to be processed twice
// resulting in the XML to be published back to the MessageBus twice.
// See https://docs.edgexfoundry.org/2.0/microservices/application/AdvancedTopics/#pipeline-per-topics for more details.
// See https://docs.edgexfoundry.org/2.2/microservices/application/AdvancedTopics/#pipeline-per-topics for more details.
err = app.service.AddFunctionsPipelineForTopics("Floats", []string{"edgex/events/#/#/Random-Float-Device/#"},
transforms.NewFilterFor(deviceNames).FilterByDeviceName,
sample.LogEventDetails,
Expand Down
6 changes: 3 additions & 3 deletions app-service-template/res/configuration.toml
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ Timeout = "30s"
# if not this secion can be removed, but you must make sure EDGEX_SECURITY_SECRET_STORE is set to false
# Note is database is running in secure more and you have Store and Forward enable you will need to run this
# service in secure mode.
# For more deatils about SecretStore: https://docs.edgexfoundry.org/1.3/microservices/security/Ch-SecretStore/
# For more deatils about SecretStore: https://docs.edgexfoundry.org/2.2/microservices/security/Ch-SecretStore/
[SecretStore]
Type = "vault"
Host = "localhost"
Expand Down Expand Up @@ -157,15 +157,15 @@ Type="edgex-messagebus"

# TODO: Add custom settings needed by your app service or remove if you don't have any settings.
# This can be any Key/Value pair you need.
# For more details see: https://docs.edgexfoundry.org/1.3/microservices/application/GeneralAppServiceConfig/#application-settings
# For more details see: https://docs.edgexfoundry.org/2.2/microservices/application/GeneralAppServiceConfig/#application-settings
# Example that works with devices from the Virtual Device service:
[ApplicationSettings]
DeviceNames = "Random-Boolean-Device, Random-Integer-Device, Random-UnsignedInteger-Device, Random-Float-Device, Random-Binary-Device"

# TODO: Replace this section with your actual structured custom configuration section
# or remove if you don't have a need for structured custom configuration
# This can be any structure you need, but it can not contain slices. Use a maps instead of slices.
# For more details see: https://docs.edgexfoundry.org/2.0/microservices/application/GeneralAppServiceConfig/#custom-configuration
# For more details see: https://docs.edgexfoundry.org/2.2/microservices/application/GeneralAppServiceConfig/#custom-configuration
[AppCustom]
ResourceNames = "Boolean, Int32, Uint32, Float32, Binary"
SomeValue = 123
Expand Down

0 comments on commit f279096

Please sign in to comment.