IBM MQQueueManager 直接连接
来源:互联网 发布:怎么挖淘宝客户的快递 编辑:程序博客网 时间:2024/06/06 23:53
package com.xiuye.mq;import java.io.IOException;import java.util.Properties;import com.ibm.mq.MQEnvironment;import com.ibm.mq.MQException;import com.ibm.mq.MQMessage;import com.ibm.mq.MQPutMessageOptions;import com.ibm.mq.MQQueue;import com.ibm.mq.MQQueueManager;public class SendMsgMQ2 {public static void main(String[] args) throws MQException, IOException {Properties props = new Properties();props.put("hostname", "192.168.1.120");props.put("port",1415);props.put("channel", "MsgChannel");props.put("CCSID",1381);//数字//props.put("transport", "transmit");//以下正确//MQEnvironment.hostname = "localhost";//MQEnvironment.port=1415;//MQEnvironment.userID = "MUSR_MQADMIN";//可以不要//MQEnvironment.password = "";//可以不要//MQEnvironment.channel = "MsgChannel";//MQEnvironment.CCSID = 1381;System.out.println(MQEnvironment.hostname);System.out.println(MQEnvironment.port);System.out.println(MQEnvironment.CCSID);System.out.println(MQEnvironment.getQueueManagerReference(1));System.out.println(MQEnvironment.getDefaultConnectionManager());MQQueueManager manager = new MQQueueManager("QM1",props);System.out.println(manager.getResolvedObjectString());System.out.println(manager.name);System.out.println(manager.getDescription());System.out.println(manager.getName());System.out.println(manager.getAlternateUserId());System.out.println(manager.getCharacterSet());System.out.println(manager.getCloseOptions());System.out.println(manager.getCommandLevel());System.out.println(manager.getOpenOptions());int openOptions = 16;MQQueue q = manager.accessQueue("localq", openOptions);MQMessage putMessage = new MQMessage();putMessage.writeUTF("TEST");MQPutMessageOptions pmo = new MQPutMessageOptions();q.put(putMessage,pmo);System.out.println("Message has been input into the remote queue");q.close();manager.disconnect();}}
1414819nullnullnullQM1 QM11381075032Message has been input into the remote queue
package com.xiuye.mq;import java.io.IOException;import java.util.Properties;import com.ibm.mq.MQC;import com.ibm.mq.MQException;import com.ibm.mq.MQGetMessageOptions;import com.ibm.mq.MQMessage;import com.ibm.mq.MQQueue;import com.ibm.mq.MQQueueManager;public class ReceiveMsgMQ2 {public static void main(String[] args) throws MQException, IOException {Properties props = new Properties();//props.put("hostname", "localhost");//props.put("port", 1415);props.put("hostname", "192.168.1.120");props.put("port",1415);props.put("channel", "MsgChannel");props.put("CCSID",1381);//数字MQQueueManager manager = new MQQueueManager("QM1", props);@SuppressWarnings("deprecation")int openOptions = MQC.MQOO_INPUT_AS_Q_DEF;MQQueue q = manager.accessQueue("localq", openOptions);MQGetMessageOptions gmo = new MQGetMessageOptions();MQMessage msg = new MQMessage();q.get(msg, gmo);System.out.println(msg.readUTF());q.close();manager.disconnect();}}
TEST
0 0
- IBM MQQueueManager 直接连接
- java连接ibm mq
- java连接ibm mq
- Java连接IBM MQ
- JAVA连接IBM MQ
- MQJMS2013 MQQueueManager的安全认证无效错误。
- ArcEngine连接数据库IBM DB2
- IBM Informix 各种连接方式
- 使用连接池连接IBM DB2数据库
- VS直接连接数据库文件
- 直接连接的网络
- JDBC直接连接数据库
- OC直接连接数据库
- 以太网PHY直接连接
- CSharp直接连接MySQL
- REM 直接上连接
- unity直接连接数据库
- IBM SPSS Modeler 【3】 Kohonen聚类分析和直接分析法
- 机器人运动学(二)
- java 工厂模式
- 大话数据结构:线性表(1)
- Android--ecilpse配置SVN插件
- UNIVERSAL IMAGE LOADER.PART 2---ImageLoaderConfiguration详解
- IBM MQQueueManager 直接连接
- redis面试题总汇
- AndroidSlidingUpPanel简析
- Lab 相关 Stack overflow(数组分配过大) 解决方法
- PowerDesigner设计建造MySQL数据库(mysql 导入sql文件)
- 获取@font-face所需字体格式
- Mysql之pt-online-schema-change在线更新大表加索引
- spring-test-dbunit的配置和使用
- BZOJ 3224 替罪羊树