本文整理汇总了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;
}
}
示例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"));
}
示例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");
}
}
示例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);
}
}
示例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");
}
}
示例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);
}