edgexfoundry / edgex-go

EdgeX Golang Services Monorepo | Owner: Core/Support WG
Apache License 2.0
1.32k stars 480 forks source link

The changedCallback function of ApplicationService.ListenForCustomConfigChanges will never be triggered #4869

Open Goatisgood opened 3 weeks ago

Goatisgood commented 3 weeks ago

🐞 Bug Report

Affected Services [REQUIRED]

ApplicationService

Description and Minimal Reproduction [REQUIRED]

I tried to add my custom configuration to configuration.yaml, and it looked like this:

Writable:
  LogLevel: INFO
Service:
  Host: localhost
  Port: 59950
  StartupMsg: my service has started
HttpServer:
  Protocol: http
  SecretName: https
  HTTPSCertName: cert
  HTTPSKeyName: key
Clients:
  core-data:
    Protocol: http
    Host: localhost
    Port: 59880
  core-command:
    UseMessageBus: true
  support-notifications:
    Protocol: http
    Host: localhost
    Port: 59860
Trigger:
  SubscribeTopics: events/#
MessageBus:
  Disabled: false
  Optional:
    ClientId: app-myapp
AppCustom:
  MyPropertyInt: 1
  MyPropertyString: 'string'

The changedCallback function of ApplicationService.ListenForCustomConfigChanges would successfully trigger after I modified any value of this configuration via Consul (port 8500).

However, when my custom configuration.yaml includes JSON array properties, like this:

...
AppCustom:
  MyPropertyInt: 1
  MyPropertyString: 'string'
  MyPropertyJsonArray: ['string1', 'string2', 'string3', 'string4', 'string5', 'string6']

The changedCallback function of ApplicationService.ListenForCustomConfigChanges is never triggered.

🌍 Your Environment

Deployment Environment: ubuntu 20.04

EdgeX Version [REQUIRED]: github.com/edgexfoundry/app-functions-sdk-go/v3 v3.1.0

cloudxxx8 commented 3 weeks ago

Consul doesn't support array structure natively Could you use map instead?