소스 검색

refactor(mqtt): revert mqtt source to use /etc/mqtt_source.yaml as the config file

ngjaying 5 년 전
부모
커밋
6376cc6653
3개의 변경된 파일6개의 추가작업 그리고 2개의 파일을 삭제
  1. 1 1
      docs/en_US/rules/sources/mqtt.md
  2. 0 0
      etc/mqtt_source.yaml
  3. 5 1
      xstream/nodes/source_node.go

+ 1 - 1
docs/en_US/rules/sources/mqtt.md

@@ -1,6 +1,6 @@
 # MQTT source 
 # MQTT source 
 
 
-Kuiper provides built-in support for MQTT source stream, which can subscribe the message from MQTT broker and feed into the Kuiper processing pipeline.  The configuration file of MQTT source is at ``$kuiper/etc/sources/mqtt.yaml``. Below is the file format.
+Kuiper provides built-in support for MQTT source stream, which can subscribe the message from MQTT broker and feed into the Kuiper processing pipeline.  The configuration file of MQTT source is at ``$kuiper/etc/mqtt_source.yaml``. Below is the file format.
 
 
 ```yaml
 ```yaml
 #Global MQTT configurations
 #Global MQTT configurations

etc/sources/mqtt.yaml → etc/mqtt_source.yaml


+ 5 - 1
xstream/nodes/source_node.go

@@ -74,7 +74,11 @@ func getConf(t string, confkey string, ctx api.StreamContext) map[string]interfa
 	if t == ""{
 	if t == ""{
 		t = "mqtt"
 		t = "mqtt"
 	}
 	}
-	conf, err := common.LoadConf("sources/" + t + ".yaml")
+	confPath := "sources/" + t + ".yaml"
+	if t == "mqtt"{
+		confPath = "mqtt_source.yaml"
+	}
+	conf, err := common.LoadConf(confPath)
 	props := make(map[string]interface{})
 	props := make(map[string]interface{})
 	if err == nil {
 	if err == nil {
 		cfg := make(map[string]map[string]interface{})
 		cfg := make(map[string]map[string]interface{})