/// <summary>
/// 创建消息队列
/// </summary>
/// <param>消息队列名称</param>
/// <returns></returns>
public void CreateNewQueue(string name)
{
if (!System.Messaging.MessageQueue.Exists(".\\private$\\" + name))//检查是否已经存在同名的消息队列
{
System.Messaging.MessageQueue mq = System.Messaging.MessageQueue.Create(".\\private$\\" + name);
mq.Label = "private$\\"+name;
Response.Write("创建成功!<br/>");
}
else
{
//System.Messaging.MessageQueue.Delete(".\\private$\\" + name);//删除一个消息队列
Response.Write("已经存在<br/>");
}
}
}
[Serializable]
public class MsgModel
{
public string id { get; set; }
public string Name { get; set; }
public MsgModel() { }
public MsgModel(string _id, string _Name)
{
id = _id;
Name = _Name;
}
public override string ToString()
{
if (string.IsNullOrEmpty(id) || string.IsNullOrEmpty(Name)) return "";
return string.Format("id--{0},Name--{1}",id,Name);
}
}
}
您可能感兴趣的文章: