請問有用過Webphere MQ傳檔案的嗎? 給個簡單的例子吧,謝了! 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 public boolean sendMessages(String aMessages,String topicID,String sendQueueName) { //send data to MQ server MQQueueManager qMgr = null; MQQueue sendQueue = null; MQMessage sendMessage = new MQMessage(); MQPutMessageOptions pmo = new MQPutMessageOptions(); MQEnvironment.hostname = "192.168.1.5"; MQEnvironment.channel = "FromJava"; MQEnvironment.CCSID = 1381; MQEnvironment.port = 1666; MQEnvironment.properties.put(MQC.TRANSPORT_PROPERTY,MQC.TRANSPORT_MQSERIES); MQEnvironment.disableTracing(); MQException.log = null; //连接到队列管理器 /**create an connection to the queue manager*/ try { System.out.println("init ok!"); qMgr = new MQQueueManager(Config.getInstance().getMQValueByName("QueueManager")); System.out.println("成功连接QueueManager"); System.out.println("debug in MQEnvironment.hostname--"+MQEnvironment.hostname); System.out.println("debug in MQEnvironment.channel--"+MQEnvironment.channel); System.out.println("debug in MQEnvironment.CCSID--"+MQEnvironment.CCSID); System.out.println("debug in MqEnvironment.getCCDTURL"+qMgr.getCCDTURL());// qMgr._getConnectionCCSID();// qMgr.getCCDTURL(); } catch (MQException ex) { ex.printStackTrace(); } /**set up the options on the queue we wish open...*/ int openOptions = MQC.MQOO_OUTPUT; try { sendQueue = qMgr.accessQueue(sendQueueName, openOptions);// sendQueue = qMgr.accessQueue("0000012", openOptions,"","0000012","0000012"); } catch (MQException mqe) { mqe.printStackTrace(); } try { //set message id byte[] data= aMessages.getBytes(); sendMessage.messageId = topicID.getBytes(); sendMessage.write(data, 0, data.length); sendQueue.put(sendMessage, pmo);// ServiceDaemon.logger.info("Send " + data.length + " Bytes To Queue:0000010."); } catch (MQException mqe) { mqe.printStackTrace(); return false; } catch (IOException ioe) { ioe.printStackTrace(); return false; }finally{ //close mq manager try { qMgr.close(); } catch (MQException ex1) { System.out.println(ex1); } } return true; 关于log4j的一个问题 java连接sqlserver2000的问题 JFrame里的JPanel切换成第二个JPane 急求答案 JAVA中的路径问题?给讲一下相对路径,当前目录下是什么意思啊, 为什么不可以显示JTable的行标题? 随便写的,大家帮忙看看,谢谢了 关于panel的布局问题,希望高手能够回答一下,谢谢 问个怎样编译的问题? 请教java中画曲线图的问题 RMI程序是否只能运行在服务器 关于MQ的问题,急!急!急!请大家帮帮小弟
//send data to MQ server
MQQueueManager qMgr = null;
MQQueue sendQueue = null;
MQMessage sendMessage = new MQMessage();
MQPutMessageOptions pmo = new MQPutMessageOptions(); MQEnvironment.hostname = "192.168.1.5";
MQEnvironment.channel = "FromJava";
MQEnvironment.CCSID = 1381;
MQEnvironment.port = 1666;
MQEnvironment.properties.put(MQC.TRANSPORT_PROPERTY,MQC.TRANSPORT_MQSERIES);
MQEnvironment.disableTracing();
MQException.log = null; //连接到队列管理器 /**create an connection to the queue manager*/
try {
System.out.println("init ok!"); qMgr = new MQQueueManager(Config.getInstance().getMQValueByName("QueueManager"));
System.out.println("成功连接QueueManager");
System.out.println("debug in MQEnvironment.hostname--"+MQEnvironment.hostname);
System.out.println("debug in MQEnvironment.channel--"+MQEnvironment.channel);
System.out.println("debug in MQEnvironment.CCSID--"+MQEnvironment.CCSID);
System.out.println("debug in MqEnvironment.getCCDTURL"+qMgr.getCCDTURL());
// qMgr._getConnectionCCSID();
// qMgr.getCCDTURL();
}
catch (MQException ex) {
ex.printStackTrace();
}
/**set up the options on the queue we wish open...*/
int openOptions = MQC.MQOO_OUTPUT;
try {
sendQueue = qMgr.accessQueue(sendQueueName, openOptions);
// sendQueue = qMgr.accessQueue("0000012", openOptions,"","0000012","0000012");
}
catch (MQException mqe) {
mqe.printStackTrace();
}
try {
//set message id
byte[] data= aMessages.getBytes();
sendMessage.messageId = topicID.getBytes();
sendMessage.write(data, 0, data.length);
sendQueue.put(sendMessage, pmo);
// ServiceDaemon.logger.info("Send " + data.length + " Bytes To Queue:0000010.");
}
catch (MQException mqe) {
mqe.printStackTrace();
return false;
}
catch (IOException ioe) {
ioe.printStackTrace();
return false;
}finally{
//close mq manager
try {
qMgr.close();
}
catch (MQException ex1) {
System.out.println(ex1);
}
}
return true;