public void SendMQ(object obj) { client.Connect(); IOutgoingMessage message = client.CreateMessage(); message.MessageData = GeneralHelper.SerializeObject(obj); message.Send(); client.Disconnect(); }
/// <summary> /// 发送消息 /// </summary> /// <param name="MQContent">消息内容</param> /// <param name="ServerName">接收端程序名,必须在服务端注册</param> public void SendMQ(string MQContent) { client.Connect(); IOutgoingMessage message = client.CreateMessage(); message.MessageData = Encoding.UTF8.GetBytes(MQContent); message.Send(); client.Disconnect(); }
/// <summary> /// 发送消息 /// </summary> /// <param name="MQContentList">消息内容数组</param> /// <param name="ServerName">接收端程序名,必须在服务端注册</param> public void SendMQ(List <string> MQContentList) { client.Connect(); IOutgoingMessage message = client.CreateMessage(); foreach (string mqc in MQContentList) { message.MessageData = Encoding.UTF8.GetBytes(mqc); message.Send(); } client.Disconnect(); }
/// <summary> /// 发送消息 /// </summary> /// <param name="MQContentList">消息内容数组</param> /// <param name="ServerNameList">接收端程序名数组,必须在服务端注册</param> public void SendMQ(List <string> MQContentList, List <string> ServerNameList) { if (MQContentList.Count == ServerNameList.Count) { client.Connect(); IOutgoingMessage message = client.CreateMessage(); for (int i = 0; i < MQContentList.Count; i++) { message.DestinationApplicationName = ServerNameList[i]; message.MessageData = Encoding.UTF8.GetBytes(MQContentList[i]); message.Send(); } client.Disconnect(); } }