I want to use JMS to connect to IBM MQ. How do i specify the queuemanager, the channel and other properties ?
Using IBM client API
import com.ibm.mq.MQEnvironment;
import com.ibm.mq.MQQueue;
import com.ibm.mq.MQQueueManager;
import com.ibm.mq.constants.CMQC;
public class QueueMonitoring {
public static void main(String[] args) {
int openOptions = CMQC.MQOO_INQUIRE | CMQC.MQOO_INPUT_AS_Q_DEF;
MQEnvironment.hostname = "192.168.59.103";
MQEnvironment.port = 1414;
MQEnvironment.channel = "SYSTEM.DEF.SVRCONN";
MQEnvironment.properties.put(CMQC.TRANSPORT_PROPERTY,CMQC.TRANSPORT_MQSERIES);
MQQueueManager qMgr;
try {
qMgr = new MQQueueManager("QM1");
MQQueue destQueue = qMgr.accessQueue("DOCKERQ", openOptions);
System.out.println("Queue size:" + destQueue.getCurrentDepth());
destQueue.close();
qMgr.disconnect();
} catch (Exception e) {
e.printStackTrace();
}
}
}