| | |
| | | |
| | | import ( |
| | | "plugin" |
| | | "ruleprocess/cache" |
| | | "basic.com/valib/logger.git" |
| | | "ruleprocess/structure" |
| | | "strconv" |
| | | ) |
| | | |
| | | |
| | | //var weedfsUrl, videoPersonUrl, personAction string |
| | | //var serverIp string |
| | | //var serverPort string |
| | | func InsertToEs(msg structure.ResultMsg) { |
| | | p,err := plugin.Open("./algorithm/insertEs.so") |
| | | defer func() { |
| | | if err := recover(); err != nil { |
| | | logger.Error("es模块儿的异常捕获:", err) |
| | | } |
| | | }() |
| | | localConfig1, err := cache.GetServerInfo() |
| | | if err != nil { |
| | | panic("配置文件不合法") |
| | | } |
| | | weedfsUrl := "http://" + localConfig1.WebPicIp + ":" + strconv.Itoa(int(localConfig1.WebPicPort)) + "/submit" |
| | | videoPersonUrl := "http://" + localConfig1.AlarmIp + ":" + strconv.Itoa(int(localConfig1.AlarmPort)) + "/" + structure.EsInfo.EsIndex.AIOcean.IndexName + "/" + structure.EsInfo.EsIndex.AIOcean.IndexType+"?refresh=true" |
| | | serverIp := localConfig1.AlarmIp |
| | | serverPort := strconv.Itoa(int(localConfig1.AlarmPort)) |
| | | handle(msg,weedfsUrl,videoPersonUrl,serverIp,serverPort) |
| | | } |
| | | |
| | | func handle (msg structure.ResultMsg,weedfsUrl,videoPersonUrl,serverIp,serverPort string) { |
| | | p,err := plugin.Open("./algorithm/middleware.so") |
| | | if err != nil { |
| | | panic(err) |
| | | } |
| | |
| | | if err1 != nil { |
| | | panic("没有找到中间件的格式化数据函数") |
| | | } |
| | | f.(func(msg structure.ResultMsg))(msg) |
| | | f.(func(msg structure.ResultMsg,weedfsUrl,videoPersonUrl,serverIp,serverPort string))(msg,weedfsUrl,videoPersonUrl,serverIp,serverPort) |
| | | } |