Sfoglia il codice sorgente

feat(edgex): conditional build for edgex related

ngjaying 5 anni fa
parent
commit
4deef081bb

+ 1 - 3
xstream/nodes/source_node.go

@@ -146,14 +146,12 @@ func (m *SourceNode) reset() {
 	m.statManagers = nil
 }
 
-func getSource(t string) (api.Source, error) {
+func doGetSource(t string) (api.Source, error) {
 	var s api.Source
 	var ok bool
 	switch t {
 	case "mqtt":
 		s = &extensions.MQTTSource{}
-	case "edgex":
-		s = &extensions.EdgexZMQSource{}
 	default:
 		nf, err := plugin_manager.GetPlugin(t, "sources")
 		if err != nil {

+ 15 - 0
xstream/nodes/with_edgex.go

@@ -0,0 +1,15 @@
+// +build linux
+
+package nodes
+
+import (
+	"github.com/emqx/kuiper/xstream/api"
+	"github.com/emqx/kuiper/xstream/extensions"
+)
+
+func getSource(t string) (api.Source, error) {
+	if t == "edgex" {
+		return &extensions.EdgexZMQSource{}, nil
+	}
+	return doGetSource(t)
+}

+ 9 - 0
xstream/nodes/without_edgex.go

@@ -0,0 +1,9 @@
+// +build !linux
+
+package nodes
+
+import "github.com/emqx/kuiper/xstream/api"
+
+func getSource(t string) (api.Source, error) {
+	return doGetSource(t)
+}