| | |
| | | package main |
| | | |
| | | import ( |
| | | "plc-recorder/msg" |
| | | "os" |
| | | "runtime" |
| | | |
| | | "plc-recorder/collector" |
| | | "plc-recorder/config" |
| | | "plc-recorder/logger" |
| | | "plc-recorder/msg" |
| | | "plc-recorder/nsqclient" |
| | | "plc-recorder/webserver" |
| | | |
| | | "github.com/rs/zerolog" |
| | | ) |
| | |
| | | // 订阅设备变更 |
| | | go nsqclient.InitNsqConsumer(config.Options.SubDeviceTopic, "plc-recorder", collector.HandleDeviceUpdate) |
| | | |
| | | // 启动采集任务 |
| | | collector.InitTask() |
| | | |
| | | // 测试数据 |
| | | go msg.TestSendDeviceLiveData() |
| | | if len(os.Args) > 1 && os.Args[1] == "-d" { |
| | | go msg.TestSendDeviceLiveData() |
| | | } |
| | | |
| | | select {} |
| | | webserver.Serve(config.Options.ServePort) |
| | | } |