Browse Source

update go kafka数据发送

dev
lucas 2 weeks ago
parent
commit
9cfe34ea18
  1. 6
      node/et_worker/et_recv/recvDataHanler.go

6
node/et_worker/et_recv/recvDataHanler.go

@ -31,7 +31,7 @@ func Recover(deviceId string, structId int, alarmType string, time time.Time) {
}
jsonOut, _ := json.Marshal(alarm)
brokers := configLoad.LoadConfig().GetStringSlice("kafka.brokers")
kafkaHelper.Send2Topic(brokers, "native_alarm", string(jsonOut))
go kafkaHelper.Send2Topic(brokers, "native_alarm", string(jsonOut))
}
func AlarmToOut(deviceId string, structId int, alarmType string, time time.Time, subDevices []string) {
alarm := common_models.AlarmMsg{
@ -51,7 +51,7 @@ func AlarmToOut(deviceId string, structId int, alarmType string, time time.Time,
}
jsonOut, _ := json.Marshal(alarm)
brokers := configLoad.LoadConfig().GetStringSlice("kafka.brokers")
kafkaHelper.Send2Topic(brokers, "native_alarm", string(jsonOut))
go kafkaHelper.Send2Topic(brokers, "native_alarm", string(jsonOut))
}
func AlarmDtuToOut(device *common_models.DeviceInfo, alarmType, alarmCode, content string, time time.Time, subDevices []string) {
alarm := common_models.AlarmMsg{
@ -71,7 +71,7 @@ func AlarmDtuToOut(device *common_models.DeviceInfo, alarmType, alarmCode, conte
}
jsonOut, _ := json.Marshal(alarm)
brokers := configLoad.LoadConfig().GetStringSlice("kafka.brokers")
kafkaHelper.Send2Topic(brokers, "native_alarm", string(jsonOut))
go kafkaHelper.Send2Topic(brokers, "native_alarm", string(jsonOut))
}
type RecvDataHanler struct {

Loading…
Cancel
Save