当前位置: 首页>>代码示例>>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;未经允许,请勿转载。