| | |
| | | import ( |
| | | "apsClient/conf" |
| | | "apsClient/constvar" |
| | | "apsClient/model/common" |
| | | "apsClient/pkg/logx" |
| | | "apsClient/pkg/safe" |
| | | "basic.com/aps/nsqclient.git" |
| | |
| | | "errors" |
| | | "fmt" |
| | | "sync" |
| | | "time" |
| | | ) |
| | | |
| | | type consumerManager struct { |
| | |
| | | if err := initProducer(); err != nil { |
| | | return err |
| | | } |
| | | safe.Go(func() { |
| | | caller := NewCaller(fmt.Sprintf(constvar.NsqTopicGetPlcAddress, conf.Conf.NsqConf.NodeId), fmt.Sprintf(constvar.NsqTopicSendPlcAddress, conf.Conf.NsqConf.NodeId)) |
| | | var addressResult common.ResponsePlcAddress |
| | | err := caller.Call(common.RequestPlcAddress{DeviceId: conf.Conf.System.DeviceId}, &addressResult, time.Second*3) |
| | | if err != nil { |
| | | logx.Infof("get plc address err: %v", err.Error()) |
| | | } |
| | | }) |
| | | |
| | | var topics = []string{ |
| | | constvar.NsqTopicScheduleTask, |
| | |
| | | constvar.NsqTopicProcessParamsResponse, |
| | | constvar.NsqTopicApsProcessParams, |
| | | constvar.NsqTopicDeviceUpdate, |
| | | constvar.NsqTopicPullDataResponse, |
| | | } |
| | | for _, t := range topics { |
| | | topic := fmt.Sprintf(t, conf.Conf.NsqConf.NodeId) |