2013-04-11 63 views
1

我應該在客戶端WebsphereMQ中設置MQMD消息上下文的位置?如何在客戶端WebsphereMQ中設置MQMD消息上下文?

MQQueueConnectionFactory mqConnectionFactory = new MQQueueConnectionFactory(); 
mqConnectionFactory.setHostName(producerProperties.getProperty("wmq.host")); 
mqConnectionFactory.setPort(Integer.valueOf(producerProperties.getProperty("wmq.port"))); 
mqConnectionFactory.setTransportType(JMSC.MQJMS_TP_CLIENT_MQ_TCPIP); 
mqConnectionFactory.setQueueManager(producerProperties.getProperty("wmq.manager")); 
mqConnectionFactory.setChannel("MyChannel"); 

/** 
* Producer Section 
*/ 
// Getting producer connection from the MQ server and starting it 
Connection producerConnection = mqConnectionFactory.createConnection(); 
System.out.println("Going to start the producer connection..."); 
producerConnection.start(); 

// JMS messages are sent and received using a Session. 
Session producerSession = producerConnection.createSession(false, 
     Session.AUTO_ACKNOWLEDGE); 
// Destination represents here our queue(testQ) on the MQ server. 
Destination producerDestination = producerSession.createQueue(producerProperties.getProperty("wmq.queue.name")); 

// MessageProducer is used for sending messages 
MessageProducer producer = producerSession.createProducer(producerDestination1); 
//create text message going to send 

TextMessage sendingMessage = producerSession.createTextMessage("Hi Welcome"); 
sendingMessage.setJMSType(queueName); 
System.out.println("Sending the message..."); 



//sending the message 
producer.send(sendingMessage); 

回答

1

請參閱示例程序。如果您安裝到默認位置在Windows上,它在:

"C:\Program Files (x86)\IBM\WebSphere MQ\tools\jms\samples\simple\SimpleMQMDWrite.java" 

或於* NIX平臺:

/opt/mqm/samp/jms/samples/simple/SimpleMQMDWrite.java 
0

轉到WMQ信息中心,並期待JMSX *和JMS_IBM_ *選擇。

相關問題