//前面是準備管理器和隊列
MQQueueManager qMgr = new MQQueueManager(qManager);
int openOptions = MQConstants.MQOO_INPUT_AS_Q_DEF | MQConstants.MQOO_OUTPUT | MQConstants.MQOO_INQUIRE;
MQQueue queue = qMgr.accessQueue(qName, openOptions);
MQMessage rcvMessage = new MQMessage();
MQGetMessageOptions gmo = new MQGetMessageOptions();
gmo.options = gmo.options + MQConstants.MQGMO_WAIT + MQConstants.MQGMO_SYNCPOINT;
//讀取五秒超時,這裏目的是要有個讀取阻塞,和Socket編程類似。
gmo.waitInterval = 5000;
queue.get(rcvMessage, gmo);
//後面就是操作消息的部分略
}catch(Exception e){{
//前面是準備管理器和隊列
MQQueueManager qMgr = new MQQueueManager(qManager);
int openOptions = MQConstants.MQOO_INPUT_AS_Q_DEF | MQConstants.MQOO_OUTPUT | MQConstants.MQOO_INQUIRE;
MQQueue queue = qMgr.accessQueue(qName, openOptions);
MQMessage rcvMessage = new MQMessage();
MQGetMessageOptions gmo = new MQGetMessageOptions();
gmo.options = gmo.options + MQConstants.MQGMO_WAIT + MQConstants.MQGMO_SYNCPOINT;
//讀取五秒超時,這裏目的是要有個讀取阻塞,和Socket編程類似。
gmo.waitInterval = 5000;
queue.get(rcvMessage, gmo);
//後面就是操作消息的部分略
}catch(Exception e){