以下是前台调用:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
public partial class _Default : System.Web.UI.Page
{
public const string MQNAME1 = "ManageTest1";
public const string MQNAME2 = "ManageTest2";
public readonly MQHelp MQHELP = new MQHelp();
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
List<string> list = new MQHelp().GetALLQueue(MQNAME1);
list.ForEach(s => ddlQueueList.Items.Add(new ListItem(s)));
}
}
protected void Button1_Click(object sender, EventArgs e)
{
Button but = sender as Button;
switch (but.Text)
{
case "添加队列":
MQHELP.CreateQueue(MQNAME1, txtQueue.Text.Trim());
break;
case "删除队列":
MQHELP.DelQueue(MQNAME1, txtQueue.Text.Trim());
break;
case "添加消息":
MQHELP.WriteMessage(MQNAME1, ddlQueueList.SelectedValue, txtMessage.Text.Trim());
break;
case "获取消息":
Literal1.Text = MQHELP.ReadMessage(MQNAME1, ddlQueueList.SelectedValue);
break;
case "添加传输队列":
MQHELP.CreateQueue(txtTMName.Text, txtTName.Text.Trim(), true);
break;
case "删除传输队列":
MQHELP.DelQueue(txtTMName.Text, txtTName.Text.Trim());
break;
case "添加远程队列":
MQHELP.CreateRemoteQueue(txtRMName.Text, txtRQName.Text, txtRMTName.Text, txtRMTQName.Text, txtRTQName.Text);
break;
case "添加发送方通道":
MQHELP.CreateChannelBySend(txtCMName.Text, txtCCName.Text, txtCTName.Text, txtCip.Text);
break;
case "添加接收方通道":
MQHELP.CreateChannelByReceive(txtCMName.Text, txtCCName.Text);
break;
default:
break;
}
}
}