當前位置: 首頁>>代碼示例>>Java>>正文


Java JMSC類代碼示例

本文整理匯總了Java中com.ibm.mq.jms.JMSC的典型用法代碼示例。如果您正苦於以下問題:Java JMSC類的具體用法?Java JMSC怎麽用?Java JMSC使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


JMSC類屬於com.ibm.mq.jms包,在下文中一共展示了JMSC類的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: buildJMSResource

import com.ibm.mq.jms.JMSC; //導入依賴的package包/類
public final void buildJMSResource() {
	
	try {
		cf = new MQConnectionFactory();
		configureMQConnectionFactory((MQConnectionFactory) cf);
		connection = cf.createConnection();
		connection.start();
		
		insession = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
		outsession = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
		
		inQueue = new MQQueue(Config.parms.getString("cmd_inq"));
		outQueue = new MQQueue(Config.parms.getString("cmd_outq"));
		
		((MQQueue) outQueue).setTargetClient(JMSC.MQJMS_CLIENT_NONJMS_MQ);
		
		messageConsumer = insession.createConsumer(inQueue);
		messageProducer = outsession.createProducer(outQueue);
		
	} catch (JMSException e) {
		Log.logger.log(Level.SEVERE,
				"Error connecting Command Processor to WebSphereMQ", e);
		return;
	}
	
}
 
開發者ID:ot4i,項目名稱:perf-harness,代碼行數:27,代碼來源:MQCommandProcessor.java

示例2: configureMQConnectionFactory

import com.ibm.mq.jms.JMSC; //導入依賴的package包/類
/**
 * Apply vendor-specific settings for building up a connection factory to
 * WMQ.
 * 
 * @param cf
 * @throws JMSException
 */
protected void configureMQConnectionFactory(MQConnectionFactory cf)
		throws JMSException {

	// always client bindings
	cf.setTransportType(JMSC.MQJMS_TP_CLIENT_MQ_TCPIP);
	cf.setHostName(Config.parms.getString("cmd_jh"));
	cf.setPort(Config.parms.getInt("cmd_p"));
	cf.setChannel(Config.parms.getString("cmd_jc"));

	cf.setQueueManager(Config.parms.getString("cmd_jb"));

}
 
開發者ID:ot4i,項目名稱:perf-harness,代碼行數:20,代碼來源:MQCommandProcessor.java

示例3: main

import com.ibm.mq.jms.JMSC; //導入依賴的package包/類
/**
 * Main method
 *
 * @param args
 */
public static void main(String[] args) {
  try {
    MQQueueConnectionFactory cf = new MQQueueConnectionFactory();

    // Config
    cf.setHostName("localhost");
    cf.setPort(1414);
    cf.setTransportType(JMSC.MQJMS_TP_CLIENT_MQ_TCPIP);
    cf.setQueueManager("QM_thinkpad");
    cf.setChannel("SYSTEM.DEF.SVRCONN");

    MQQueueConnection connection = (MQQueueConnection) cf.createQueueConnection();
    MQQueueSession session = (MQQueueSession) connection.createQueueSession(false, Session.AUTO_ACKNOWLEDGE);
    MQQueue queue = (MQQueue) session.createQueue("queue:///Q1");
    MQQueueSender sender =  (MQQueueSender) session.createSender(queue);
    MQQueueReceiver receiver = (MQQueueReceiver) session.createReceiver(queue);

    long uniqueNumber = System.currentTimeMillis() % 1000;
    JMSTextMessage message = (JMSTextMessage) session.createTextMessage("SimplePTP "+ uniqueNumber);

    // Start the connection
    connection.start();

    sender.send(message);
    System.out.println("Sent message:\\n" + message);

    JMSMessage receivedMessage = (JMSMessage) receiver.receive(10000);
    System.out.println("\\nReceived message:\\n" + receivedMessage);

    sender.close();
    receiver.close();
    session.close();
    connection.close();

    System.out.println("\\nSUCCESS\\n");
  }
  catch (JMSException jmsex) {
    System.out.println(jmsex);
    System.out.println("\\nFAILURE\\n");
  }
  catch (Exception ex) {
    System.out.println(ex);
    System.out.println("\\nFAILURE\\n");
  }
}
 
開發者ID:windup,項目名稱:windup-rulesets,代碼行數:51,代碼來源:SimplePTP.java

示例4: configureWBIMBConnectionFactory

import com.ibm.mq.jms.JMSC; //導入依賴的package包/類
/**
 * Provide additional functionality for WMB connection factories.
 */
private void configureWBIMBConnectionFactory(MQConnectionFactory cf) throws JMSException {

		//Set common attributes i.e. version,port,hostname and buffersize.			
		//Set the broker version we will use version 2 is suitable for argo brokers
		cf.setBrokerVersion(brokerVersion);
		cf.setHostName(Config.parms.getString("jh"));
		cf.setPort(Config.parms.getInt("jp"));
		if (bufferSize > 0)
		{
			cf.setMaxBufferSize(bufferSize);
		}

		if (transport.equals("ip"))
		{
			System.out.println("Using transport type MQJMS_TP_DIRECT_TCPIP");
			cf.setTransportType(JMSC.MQJMS_TP_DIRECT_TCPIP);
		}
		else if (transport.equals("ipmc"))
		{
			System.out.println("Using transport type MQJMS_TP_DIRECT_TCPIP, Multicast Enabled");
			cf.setTransportType(JMSC.MQJMS_TP_DIRECT_TCPIP);
			cf.setMulticast(JMSC.MQJMS_MULTICAST_ENABLED);
		}
		else if (transport.equals("ipmcr"))
		{
			System.out.println("Using transport type MQJMS_TP_DIRECT_TCPIP, Multicast Enabled & Reliable");
			cf.setTransportType(JMSC.MQJMS_TP_DIRECT_TCPIP);
			cf.setMulticast(JMSC.MQJMS_MULTICAST_RELIABLE);
		}
		else if (transport.equals("ipmcn"))
		{
			System.out.println("Using transport type MQJMS_TP_DIRECT_TCPIP, Multicast Enabled & NOT Reliable");
			cf.setTransportType(JMSC.MQJMS_TP_DIRECT_TCPIP);
			cf.setMulticast(JMSC.MQJMS_MULTICAST_NOT_RELIABLE);
		}
		else if (transport.equals("mqb"))
		{
			//Place holder statement incase we ever need to do anything for this transport over and above what the MQ plugin already does.
			cf.setBrokerQueueManager(Config.parms.getString("jb"));
		}
		else if (transport.equals("mqc"))
		{
			//Place holder statement incase we ever need to do anything for this transport over and above what the MQ plugin already does.
			cf.setBrokerQueueManager(Config.parms.getString("jb"));
		}
		else
		{
			System.out.println("Invalid transport type");
			System.exit(1);
		}
		

}
 
開發者ID:ot4i,項目名稱:perf-harness,代碼行數:57,代碼來源:WMB.java

示例5: main

import com.ibm.mq.jms.JMSC; //導入依賴的package包/類
/**
 * Main method.
 *
 * @param args
 */
public static void main(String[] args) {
  try {
    MQTopicConnectionFactory cf = new MQTopicConnectionFactory();

    // Config
    cf.setHostName("localhost");
    cf.setPort(1414);
    cf.setTransportType(JMSC.MQJMS_TP_CLIENT_MQ_TCPIP);
    cf.setQueueManager("QM_thinkpad");
    cf.setChannel("SYSTEM.DEF.SVRCONN");

    MQTopicConnection connection = (MQTopicConnection) cf.createTopicConnection();
    MQTopicSession session = (MQTopicSession) connection.createTopicSession(false, Session.AUTO_ACKNOWLEDGE);
    MQTopic topic = (MQTopic) session.createTopic("topic://foo");
    MQTopicPublisher publisher =  (MQTopicPublisher) session.createPublisher(topic);
    MQTopicSubscriber subscriber = (MQTopicSubscriber) session.createSubscriber(topic);

    long uniqueNumber = System.currentTimeMillis() % 1000;
    JMSTextMessage message = (JMSTextMessage) session.createTextMessage("SimplePubSub "+ uniqueNumber);

    // Start the connection
    connection.start();

    publisher.publish(message);
    System.out.println("Sent message:\\n" + message);

    JMSMessage receivedMessage = (JMSMessage) subscriber.receive(10000);
    System.out.println("\\nReceived message:\\n" + receivedMessage);

    publisher.close();
    subscriber.close();
    session.close();
    connection.close();

    System.out.println("\\nSUCCESS\\n");
  }
  catch (JMSException jmsex) {
    System.out.println(jmsex);
    System.out.println("\\nFAILURE\\n");
  }
  catch (Exception ex) {
    System.out.println(ex);
    System.out.println("\\nFAILURE\\n");
  }
}
 
開發者ID:windup,項目名稱:windup-rulesets,代碼行數:51,代碼來源:SimplePubSub.java

示例6: setTargetClientMQ

import com.ibm.mq.jms.JMSC; //導入依賴的package包/類
private void setTargetClientMQ(Destination destination) throws JMSException {
	log.debug("[" + getName() + "] set target client for queue [" + destination.toString() + "] to NONJMS_MQ");
	((MQDestination)destination).setTargetClient(JMSC.MQJMS_CLIENT_NONJMS_MQ);
}
 
開發者ID:ibissource,項目名稱:iaf,代碼行數:5,代碼來源:MQSender.java


注:本文中的com.ibm.mq.jms.JMSC類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。