java tomcat ibm mq谁有经验?
import java.util.Hashtable;
import com.ibm.mq.*;
public class mqComm{
private String qmName = " ";
private String qName = " ";
private com.ibm.mq.MQQueueManager qMgr = null
private Hashtable properties = new Hashtable();
public mqComm(String qmName, String qName) {
this.qmName = qmName;
this.qName = qName;
configEnviroment();
try {
qMgr = new MQQueueManager(qmName, properties);
} catch (MQException e) {
Loger.log.error( "Create MQQueueManager error!qmName=[ " + qmName + "]qName=[ " + qName + "] " + e);
}
}
public void configEnviroment() {
properties.put( "CCSID ", new Integer(1381));
}
public int putMsg(String buff) {
int openOptions = MQC.MQOO_OUTPUT|MQC.MQOO_FAIL_IF_QUIESCING;
try {
MQQueue queue = qMgr.accessQueue(qName,openOptions,null,null,null);
MQPutMessageOptions pmo = new MQPutMessageOptions();
pmo.options = pmo.options+MQC.MQGMO_SYNCPOINT;
MQMessage outmsg = new MQMessage();
outmsg.characterSet = 1381;
outmsg.format = MQC.MQFMT_STRING;
outmsg.writeString(buff);
queue.put(outmsg,pmo);
qMgr.commit();
&n