ソースを参照

增加日志节点

lijian 1 年間 前
コミット
8ec4565d72
1 ファイル変更10 行追加7 行削除
  1. 10 7
      pkg/ruleEngine/nodes/deviceid_filter_node.go

+ 10 - 7
pkg/ruleEngine/nodes/deviceid_filter_node.go

@@ -36,15 +36,18 @@ func (d *DeviceIdFilterNode) Init(ctx ruleEngine.Context, config string) error {
 func (d *DeviceIdFilterNode) OnMessage(ctx ruleEngine.Context, message *protocol.Message) error {
 	msgDeviceId, ok := message.MetaData["device_id"]
 	if ok {
-		if msgDeviceId.(string) == d.config.DeviceId {
+		if msgDeviceId.(string) != "" && msgDeviceId.(string) == d.config.DeviceId {
 			ctx.TellNext(message, protocol.True)
+			return nil
+		} else {
+			ctx.TellNext(message, protocol.False)
 		}
 	}
-	if msgSubDeviceId, ok := message.MetaData["sub_device_id"]; ok {
-		if msgSubDeviceId.(string) == d.config.SubDeviceId {
-			ctx.TellNext(message, protocol.True)
-		}
-	}
-	ctx.TellNext(message, protocol.False)
+	//if msgSubDeviceId, ok := message.MetaData["sub_device_id"]; ok {
+	//	if msgSubDeviceId.(string) == d.config.SubDeviceId {
+	//		ctx.TellNext(message, protocol.True)
+	//	}
+	//}
+
 	return nil
 }