Ver código fonte

更新订阅

liuxiulin 4 meses atrás
pai
commit
20f38b55c8
2 arquivos alterados com 15 adições e 15 exclusões
  1. 3 3
      services/emqx-agent/main.go
  2. 12 12
      services/emqx-agent/sub_dev.go

+ 3 - 3
services/emqx-agent/main.go

@@ -240,9 +240,9 @@ func main() {
 		panic(err)
 	}
 	agent := NewAgent(sd)
-	//err = sd.SubDevMsg(func(ctx context.Context) DevSubHandle {
-	//	return agent
-	//})
+	err = sd.SubDevMsg(func(ctx context.Context) DevSubHandle {
+		return agent
+	})
 	if err != nil {
 		panic(err)
 	}

+ 12 - 12
services/emqx-agent/sub_dev.go

@@ -138,18 +138,18 @@ func (d *MqttClient) subDevMsg(cli mqtt.Client, handle Handle) error {
 	if err != nil {
 		return err
 	}
-	err = d.subscribeWithFunc(cli, TopicSDKLog, func(ctx context.Context, topic string, payload []byte) error {
-		return handle(ctx).Message(topic, payload)
-	})
-	if err != nil {
-		return err
-	}
-	err = d.subscribeWithFunc(cli, TopicEvent, func(ctx context.Context, topic string, payload []byte) error {
-		return handle(ctx).Message(topic, payload)
-	})
-	if err != nil {
-		return err
-	}
+	//err = d.subscribeWithFunc(cli, TopicSDKLog, func(ctx context.Context, topic string, payload []byte) error {
+	//	return handle(ctx).Message(topic, payload)
+	//})
+	//if err != nil {
+	//	return err
+	//}
+	//err = d.subscribeWithFunc(cli, TopicEvent, func(ctx context.Context, topic string, payload []byte) error {
+	//	return handle(ctx).Message(topic, payload)
+	//})
+	//if err != nil {
+	//	return err
+	//}
 	return nil
 }