|
@@ -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 {
|
|
func (d *DeviceIdFilterNode) OnMessage(ctx ruleEngine.Context, message *protocol.Message) error {
|
|
msgDeviceId, ok := message.MetaData["device_id"]
|
|
msgDeviceId, ok := message.MetaData["device_id"]
|
|
if ok {
|
|
if ok {
|
|
- if msgDeviceId.(string) == d.config.DeviceId {
|
|
|
|
|
|
+ if msgDeviceId.(string) != "" && msgDeviceId.(string) == d.config.DeviceId {
|
|
ctx.TellNext(message, protocol.True)
|
|
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
|
|
return nil
|
|
}
|
|
}
|