|
@@ -1,11 +1,13 @@
|
|
|
package nodes
|
|
|
|
|
|
import (
|
|
|
+ "context"
|
|
|
"encoding/json"
|
|
|
"fmt"
|
|
|
MQTT "git.eclipse.org/gitroot/paho/org.eclipse.paho.mqtt.golang.git"
|
|
|
"github.com/gogf/gf/util/guid"
|
|
|
"html/template"
|
|
|
+ "sparrow/pkg/logger"
|
|
|
"sparrow/pkg/protocol"
|
|
|
"sparrow/pkg/ruleEngine"
|
|
|
"strings"
|
|
@@ -54,11 +56,11 @@ type MQTTBrokerNodeCfg struct {
|
|
|
}
|
|
|
|
|
|
func (M *MQTTBrokerNode) Init(ctx ruleEngine.Context, config string) error {
|
|
|
- fmt.Printf("进入初始化:%s\r\n", config)
|
|
|
if config != "" {
|
|
|
c := new(MQTTBrokerNodeCfg)
|
|
|
err := json.Unmarshal([]byte(config), c)
|
|
|
if err != nil {
|
|
|
+ logger.Errorf(context.Background(), "初始化失败:%s", err.Error())
|
|
|
return err
|
|
|
}
|
|
|
M.config = c
|