| | |
| | | : ConfigureList.Find(x => x.ConfigureParas.RegisterCode == mySession.RegisterCode); |
| | | if (configure == null) |
| | | { |
| | | LogHelper.Info($"Socket数据对接任务中,端口:{mySession.Server.Options.Listeners.First().Port},收到一条无法识别的消息:{message_str}"); |
| | | configure = string.IsNullOrEmpty(mySession.Heartbeat) ? ConfigureList.Find(x => x.ConfigureParas.Heartbeat == message_str) |
| | | : ConfigureList.Find(x => x.ConfigureParas.Heartbeat == mySession.Heartbeat); |
| | | if (configure != null) |
| | | { |
| | | mySession.Close($"关闭:[{configure.Name}]连接,未检测到注册码!"); |
| | | return; |
| | | } |
| | | } |
| | | if (configure == null) |
| | | { |
| | | LogHelper.Info($"Socket数据对接任务中端口[{mySession.Server.Options.Listeners.First().Port}]收到一条无法识别的消息:{message_str}"); |
| | | return; |
| | | } |
| | | |
| | |
| | | var dataDocking = DataDockingSocketFactory.CreateSocket<IDataDockingSocket.IHandleHelper>(configure.ConfigureParas.DependencyFile); |
| | | if (dataDocking == null) |
| | | { |
| | | LogHelper.Info($"Socket数据对接中,{configure.Name},创建数据对接对象失败!"); |
| | | LogHelper.Info($"Socket数据对接中[{configure.Name}]创建数据对接对象失败!"); |
| | | return; |
| | | } |
| | | if (message_str == mySession.RegisterCode) |
| | |
| | | } |
| | | else if (message_str == mySession.Heartbeat) |
| | | { |
| | | LogHelper.Info($"Socket数据对接中,{configure.Name},接收到心跳包:{message_str}"); |
| | | LogHelper.Info($"Socket数据对接中[{configure.Name}]接收到心跳包:{message_str}"); |
| | | dataDocking.HandleHeartbeat(mySession); |
| | | } |
| | | else |
| | | { |
| | | LogHelper.Info($"Socket数据对接中,{configure.Name},接收到数据:{message_bts}"); |
| | | LogHelper.Info($"Socket数据对接中[{configure.Name}]接收到数据:{message_bts}"); |
| | | dataDocking.HandleData(mySession, requestInfo.Body, configure.Mappers, (receive_list) => |
| | | { |
| | | if (receive_list == null || receive_list.Count < 1) |
| | | { |
| | | LogHelper.Info($"Socket数据对接中,注册码:{configure.Name},获取测点记录失败!"); |
| | | LogHelper.Info($"Socket数据对接,注册码[{configure.Name}]获取测点记录失败!"); |
| | | return; |
| | | } |
| | | var queue = new RabbitMqQueueHelper(); |
| | |
| | | ConfigureID = configure.ID, |
| | | Records = receive_list |
| | | }); |
| | | LogHelper.Info($"Socket数据对接中:{configure.Name},成功推入通道{receive_list.Count()}条数据!"); |
| | | LogHelper.Info($"Socket数据对接中[{configure.Name}]成功推入通道{receive_list.Count()}条数据!"); |
| | | }); |
| | | } |
| | | |
| | | |
| | | }); |
| | | |
| | | |
| | | } |
| | | }); |
| | | } |
| | | |
| | | |