Skip to content

Commit

Permalink
refactor!: Replace internal topics from config with new constants and…
Browse files Browse the repository at this point in the history
… use base topic (#520)

BREAKING CHANGE: Internal topics no longer configurable, except the base topic. Trigger topics for edgex-messagebus and external-mqtt now directly under Trigger section. All configured topics (subscribe and function pipeline) now automatically have the base topic (default of "edgex/") prepended.

Signed-off-by: Leonard Goodell <leonard.goodell@intel.com>
  • Loading branch information
Lenny Goodell authored Feb 18, 2023
1 parent 731cbe3 commit ae5c3a2
Show file tree
Hide file tree
Showing 9 changed files with 42 additions and 34 deletions.
6 changes: 6 additions & 0 deletions Attribution.txt
Original file line number Diff line number Diff line change
Expand Up @@ -203,3 +203,9 @@ https://github.com/nats-io/nkeys/blob/master/LICENSE

github.com/nats-io/nuid (Apache-2.0) https://github.com/nats-io/nuid
https://github.com/nats-io/nuid/blob/master/LICENSE

golang.org/x/mod (BSD-3) https://github.com/golang/mod
https://github.com/golang/mod/blob/master/LICENSE

golang.org/x/tools (BSD-3) https://github.com/golang/tools
https://github.com/golang/tools/blob/master/LICENSE
8 changes: 4 additions & 4 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,18 @@ module github.com/edgexfoundry/app-service-configurable

go 1.18

require github.com/edgexfoundry/app-functions-sdk-go/v3 v3.0.0-dev.29
require github.com/edgexfoundry/app-functions-sdk-go/v3 v3.0.0-dev.31

require (
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.7 // indirect
github.com/eclipse/paho.mqtt.golang v1.4.2 // indirect
github.com/edgexfoundry/go-mod-bootstrap/v3 v3.0.0-dev.22 // indirect
github.com/edgexfoundry/go-mod-bootstrap/v3 v3.0.0-dev.24 // indirect
github.com/edgexfoundry/go-mod-configuration/v3 v3.0.0-dev.3 // indirect
github.com/edgexfoundry/go-mod-core-contracts/v3 v3.0.0-dev.10 // indirect
github.com/edgexfoundry/go-mod-messaging/v3 v3.0.0-dev.7 // indirect
github.com/edgexfoundry/go-mod-core-contracts/v3 v3.0.0-dev.14 // indirect
github.com/edgexfoundry/go-mod-messaging/v3 v3.0.0-dev.9 // indirect
github.com/edgexfoundry/go-mod-registry/v3 v3.0.0-dev.3 // indirect
github.com/edgexfoundry/go-mod-secrets/v3 v3.0.0-dev.7 // indirect
github.com/fatih/color v1.9.0 // indirect
Expand Down
16 changes: 8 additions & 8 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -28,16 +28,16 @@ github.com/diegoholiveira/jsonlogic/v3 v3.2.7 h1:awX07pFPnlntZzRNBcO4a2Ivxa77NMt
github.com/diegoholiveira/jsonlogic/v3 v3.2.7/go.mod h1:9oE8z9G+0OMxOoLHF3fhek3KuqD5CBqM0B6XFL08MSg=
github.com/eclipse/paho.mqtt.golang v1.4.2 h1:66wOzfUHSSI1zamx7jR6yMEI5EuHnT1G6rNA5PM12m4=
github.com/eclipse/paho.mqtt.golang v1.4.2/go.mod h1:JGt0RsEwEX+Xa/agj90YJ9d9DH2b7upDZMK9HRbFvCA=
github.com/edgexfoundry/app-functions-sdk-go/v3 v3.0.0-dev.29 h1:9Qtfvkk5NRPfMpjg1emn98g/JnTjqC9MFrCNasJdmhY=
github.com/edgexfoundry/app-functions-sdk-go/v3 v3.0.0-dev.29/go.mod h1:pYkbsBEQP2JXFo1QXyxUGpXJK+KTaqMNEOmSQaexV0o=
github.com/edgexfoundry/go-mod-bootstrap/v3 v3.0.0-dev.22 h1:DrtTbcDU6VMoMmsAn9tQpxQ+MIwgtSBmSwuZLgFuDEQ=
github.com/edgexfoundry/go-mod-bootstrap/v3 v3.0.0-dev.22/go.mod h1:rVklwwUju+/MGOij+KJeBJZ+/HIo6YsQwlFv7UmsA+8=
github.com/edgexfoundry/app-functions-sdk-go/v3 v3.0.0-dev.31 h1:hivdzLAGSlzE+pBHjPrKtw0R6F9Sj5gL9vknEHKreKY=
github.com/edgexfoundry/app-functions-sdk-go/v3 v3.0.0-dev.31/go.mod h1:AZvJxuxhvwUuV/UIZTE0sb2/ydB7wFtn1ywTd789irI=
github.com/edgexfoundry/go-mod-bootstrap/v3 v3.0.0-dev.24 h1:H9MC0ahbkMw4w1SHeX6/GVR5tC6E+Bz6ZiPECmnzO3c=
github.com/edgexfoundry/go-mod-bootstrap/v3 v3.0.0-dev.24/go.mod h1:iv/czxi4ciFWMgrO+3nnanGfkT2X1QW5L3iCb+deewk=
github.com/edgexfoundry/go-mod-configuration/v3 v3.0.0-dev.3 h1:0Ew4PzLSFJ+sb7AYtvb9m1mRN45Sh0ELU1HdMCel5t8=
github.com/edgexfoundry/go-mod-configuration/v3 v3.0.0-dev.3/go.mod h1:ESOWI4GokQfQ3Bn2hGsdfOVx5idj7QEdCPT/SAQDd9M=
github.com/edgexfoundry/go-mod-core-contracts/v3 v3.0.0-dev.10 h1:o5yenvmLn8+0AOz0d5GIek011Tt5ZRbvPlgE4VhozEU=
github.com/edgexfoundry/go-mod-core-contracts/v3 v3.0.0-dev.10/go.mod h1:4lpZUM54ZareGU/yuAJvLEw0BoJ43SvCj1LO+gsKm9c=
github.com/edgexfoundry/go-mod-messaging/v3 v3.0.0-dev.7 h1:jgDQA/7SENURXQkIX11pNgA/pX9IK9ZULenj/vF17Vw=
github.com/edgexfoundry/go-mod-messaging/v3 v3.0.0-dev.7/go.mod h1:r6Klfz+QBDx1Z5UV0z70MKdK2/cgHwhtqTm2HFXoWug=
github.com/edgexfoundry/go-mod-core-contracts/v3 v3.0.0-dev.14 h1:o7CFEIyKn/quin5lrAlUbUu9x1dnecK0tZs5waLhdCc=
github.com/edgexfoundry/go-mod-core-contracts/v3 v3.0.0-dev.14/go.mod h1:4lpZUM54ZareGU/yuAJvLEw0BoJ43SvCj1LO+gsKm9c=
github.com/edgexfoundry/go-mod-messaging/v3 v3.0.0-dev.9 h1:CUUieXQ8roD4M770GXj1he707V3V9Jiygk302+dwvKk=
github.com/edgexfoundry/go-mod-messaging/v3 v3.0.0-dev.9/go.mod h1:iKBxmZkc7jdOrT99+IR1nyg7PlRgooAQMhZxDh2mTUQ=
github.com/edgexfoundry/go-mod-registry/v3 v3.0.0-dev.3 h1:QgZF9f70Cwpvkjw3tP1aiVGHc+yNFJNzW6hO8pDs3fg=
github.com/edgexfoundry/go-mod-registry/v3 v3.0.0-dev.3/go.mod h1:2w8v0sv+i21nY+DY6JV4PFxsNTuxpGAjlNFlFMTfZkk=
github.com/edgexfoundry/go-mod-secrets/v3 v3.0.0-dev.7 h1:9Mn389IHlgoPgGUpwnLzoe/shylkQI+nXI3E/AfnYDA=
Expand Down
6 changes: 3 additions & 3 deletions res/external-mqtt-trigger/configuration.toml
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,11 @@ Disabled = true

[Trigger]
Type="external-mqtt"
SubscribeTopics="external-request/#"
PublishTopic="" # optional if publishing response back to the the External MQTT Broker
[Trigger.ExternalMqtt]
Url = "tcp://localhost:1883" # fully qualified URL to connect to the MQTT broker
SubscribeTopics="external-request/#"
PublishTopic="" # optional if publishing response back to the the External MQTT Broker
ClientId = "external-mqtt-trigger"
ClientId = "external-mqtt-trigger"
ConnectTimeout = "5s" # 5 seconds
AutoReconnect = true
KeepAlive = 10 # Seconds (must be 2 or greater)
Expand Down
4 changes: 2 additions & 2 deletions res/http-export/configuration.toml
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,8 @@ Port = 59704
StartupMsg = "app-http-export has Started"

[MessageBus]
[MessageBus.Topics]
SubscribeTopics = "edgex/events/#"
[MessageBus.Optional]
# Default MQTT Specific options that need to be here to enable evnironment variable overrides of them
ClientId ="app-http-export"

# Using default Trigger config from common config
6 changes: 4 additions & 2 deletions res/metrics-influxdb/configuration.toml
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,10 @@ Port = 59707
StartupMsg = "app-metrics-influxdb has Started"

[MessageBus]
[MessageBus.Topics]
SubscribeTopics = "edgex/telemetry/#"
[MessageBus.Optional]
# Default MQTT Specific options that need to be here to enable evnironment variable overrides of them
ClientId ="app-metrics-influxdb"

[Trigger]
# Note that the MessageBus connection above is used by edgex-messagebus trigger which is the default set in common config
SubscribeTopics = "telemetry/#" # Base topic is prepened to this topic when using edgex-messagebus
6 changes: 3 additions & 3 deletions res/mqtt-export/configuration.toml
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,8 @@ Port = 59703
StartupMsg = "app-mqtt-export has Started"

[MessageBus]
[MessageBus.Topics]
SubscribeTopics = "edgex/events/#"
[MessageBus.Optional]
# Default MQTT Specific options that need to be here to enable evnironment variable overrides of them
ClientId ="app-mqtt-export"
ClientId ="app-mqtt-export"

# Using default Trigger config from common config
8 changes: 5 additions & 3 deletions res/rules-engine/configuration.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,11 @@ Port = 59701
StartupMsg = "app-rules-engine has Started"

[MessageBus]
[MessageBus.Topics]
SubscribeTopics = "edgex/events/#"
PublishTopic="rules-events"
[MessageBus.Optional]
# Default MQTT Specific options that need to be here to enable evnironment variable overrides of them
ClientId ="app-rules-engine"

[Trigger]
# Note that the MessageBus connection above is used by edgex-messagebus trigger which is the default set in common config
# Default value for SubscribeTopics is aslo set in common config
PublishTopic="rules-events" # Base topic is prepened to this topic when using edgex-messagebus
16 changes: 7 additions & 9 deletions res/sample/configuration.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@ LogLevel = "INFO"
[Writable.Pipeline.PerTopicPipelines]
[Writable.Pipeline.PerTopicPipelines.float]
Id = "float-pipeline"
Topics = "edgex/events/device/+/Random-Float-Device/#"
Topics = "events/device/device-virtual/Random-Float-Device/#"
ExecutionOrder = "TransformJson, SetResponseData"
[Writable.Pipeline.PerTopicPipelines.int8-16]
Id = "int8-16-pipeline"
Topics = "edgex/events/device/+/+/Int8, edgex/events/device/+/+/Int16"
Topics = "events/device/device-virtual/+/+/Int8, events/device/device-virtual/+/+/Int16"
ExecutionOrder = "TransformXml, SetResponseData"

# The Pipeline.Functions sections define the parameter configuration for each specific function.
Expand Down Expand Up @@ -162,10 +162,6 @@ StartupMsg = "app-sample has Started"
# Only valid if MessageBus Trigger is used
# If prefer REST, remove below and uncomment above
UseMessageBus = true
[Clients.core-command.Topics]
CommandQueryRequestTopicPrefix = "edgex/core/commandquery/request"
CommandRequestTopicPrefix = "edgex/core/command/request"
ResponseTopicPrefix = "edgex/response"

# Used for Notification and Subscription client, which are not currently used by any configurable functions
[Clients.support-notifications]
Expand All @@ -175,9 +171,11 @@ StartupMsg = "app-sample has Started"

[MessageBus]
Disabled = false # Set to true if not using edgex-messagebus Trigger below and don't want Metrics or Commands via MessageBus
[MessageBus.Topics]
SubscribeTopics = "edgex/events/#"
PublishTopic="sample"
[MessageBus.Optional]
# Default MQTT Specific options that need to be here to enable evnironment variable overrides of them
ClientId ="app-sample"

[Trigger]
# Note that the MessageBus connection above is used by edgex-messagebus trigger which is the default set in common config
# Default value for SubscribeTopics is aslo set in common config
PublishTopic="sample" # Base topic is prepened to this topic when using edgex-messagebus

0 comments on commit ae5c3a2

Please sign in to comment.