using NetMQ; using NetMQ.Sockets; using Newtonsoft.Json; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using ToolLibrary.LogHelper; using YunDa.ISAS.DataTransferObject.Iec104; namespace YunDa.ISAS.Application.Core.MessageQeue { internal class NetMQManager { } public class NetMQRequestSocketManager { private readonly RequestSocket _pubSocket; public NetMQRequestSocketManager(string url) { try { _pubSocket = new RequestSocket(url); _pubSocket.Options.SendHighWatermark = 1000; Log4Helper.Info(this.GetType(), "NetMq订阅完成"); } catch (Exception ex) { Log4Helper.Error(this.GetType(), "NetMq订阅错误", ex); } } public void SendMsg(SndMsg msg) { var jsonMsg = JsonConvert.SerializeObject(msg); _pubSocket.SendMoreFrame("measureTempServer").SendFrame(jsonMsg); } } }