You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
22 lines
495 B
22 lines
495 B
package kafka
|
|
|
|
import (
|
|
"dataSource"
|
|
"encoding/json"
|
|
"gitea.anxinyun.cn/container/common_models"
|
|
"log"
|
|
)
|
|
|
|
type IotaDataHandler struct{}
|
|
|
|
func (h IotaDataHandler) HandleMessage(message string) bool {
|
|
// 处理 alarm 消息
|
|
rawData := common_models.IotaData{}
|
|
err := json.Unmarshal([]byte(message), &rawData)
|
|
if err != nil {
|
|
return false
|
|
}
|
|
log.Printf("handler 处理[%s|%s]消息", rawData.DeviceId, rawData.TriggerTime)
|
|
dataSource.GetChannels().RawDataChan <- rawData
|
|
return true
|
|
}
|
|
|