Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static void main(String[] args) throws JMSException {
- // TODO Auto-generated method stub
- try{
- MQEnvironment.disableTracing();
- MQQueueConnectionFactory cf = new MQQueueConnectionFactory();
- cf.setStringProperty(WMQConstants.WMQ_HOST_NAME, "localhost");
- cf.setStringProperty(WMQConstants.WMQ_PORT, "1414");
- cf.setStringProperty(WMQConstants.WMQ_CHANNEL, "TEST_SVR_CONN");
- cf.setStringProperty(WMQConstants.WMQ_QUEUE_MANAGER, "DEVTESTQUEUE");
- //cf.setIntProperty(WMQConstants.WMQ_CONNECTION_MODE, WMQConstants.WMQ_CM_DIRECT_HTTP);
- //cf.setTransportType(WMQConstants.WMQ_CM_BINDINGS);
- //set MQServer =
- //HelloWorldConsumer.HelloWorldProducer();
- MQQueueConnection connection = (MQQueueConnection) cf.createQueueConnection();
- MQSession session = (MQSession) connection.createQueueSession(false, Session.AUTO_ACKNOWLEDGE);
- MQQueue queue = (MQQueue) session.createQueue("REQUEST");
- //queue.setMessageBodyStyle(WMQConstants.WMQ_MESSAGE_BODY_MQ);
- queue.setTargetClient(WMQConstants.WMQ_TARGET_DEST_MQ);
- queue.setProperty("PROPCTL", "ALL");
- ((com.ibm.mq.jms.MQQueue)queue).setIntProperty(WMQConstants.WMQ_TARGET_CLIENT, WMQConstants.WMQ_TARGET_DEST_MQ);
- connection.start();
- MessageConsumer consumer = session.createConsumer(queue);
- consumer.setMessageListener(new HelloWorldConsumer());
- session.close();
- connection.close();
- System.out.println("------END------");
- }catch(JMSException je){
- je.printStackTrace();
- }catch(Exception e){
- e.printStackTrace();
- }
- }
Add Comment
Please, Sign In to add comment