ibm websphere mq 5.3升级到csd05之后,提供了使用.net操作mq的类库,安装完成之后,会在mq的安装目录的bin文件夹下面多出一个amqmdnet.dll文件,把这个dll作为引用添加到你的.net工程中,你的.net程序中就可以操作ibm websphere mq。
我的mq是中文版的,操作系统是win2k003 sp1,无论是在队列管理器,还是用代码新建的队列,都与我本机时间相差8小时,不晓得何解,哪位高人可以释疑?
//新建本地队列
pcfmessageagent agent = new pcfmessageagent("qm_janus");
pcfmessage request = new pcfmessage(cmqcfc.mqcmd_create_q);
request.addparameter(mqc.mqca_q_name, "test_queue");
request.addparameter(mqc.mqia_q_type, mqc.mqqt_local);
//request.addparameter(mqc.mqia_usage, mqc.mqus_transmission);
pcfmessage[] response = agent.send(request);
//删除队列
pcfmessageagent agent = new pcfmessageagent("qm_janus");
pcfmessage request = new pcfmessage(cmqcfc.mqcmd_delete_q);
request.addparameter(mqc.mqca_q_name, "test_queue");
pcfmessage[] response = agent.send(request);
//从队列中读取消息
mqqueuemanager qmgr = new mqqueuemanager("qm_janus");
mqqueue queue = qmgr.accessqueue("postcard", mqc.mqoo_input_as_q_def | mqc.mqoo_fail_if_quiescing);
mqgetmessageoptions gmo = new mqgetmessageoptions();
gmo.options = mqc.mqgmo_wait;
gmo.waitinterval = 1000;
gmo.matchoptions = mqc.mqmo_none;
mqmessage message = new mqmessage();
queue.get(message);
//向队列写消息
mqqueuemanager qmgr = new mqqueuemanager("qm_janus");
mqqueue queue = qmgr.accessqueue("postcard", mqc.mqoo_output);
mqmessage message = new mqmessage();
message.writestring("message body");
queue.put(message);
//枚举所有队列
pcfmessageagent agent = new pcfmessageagent("qm_janus");
pcfmessage request = new pcfmessage(cmqcfc.mqcmd_inquire_q_names);
request.addparameter(mqc.mqca_q_name, "*");
pcfmessage[] response = agent.send(request);
string[] names = response[0].getstringlistparametervalue(cmqcfc.mqcacf_q_names);
新闻热点
疑难解答