【发布时间】:2016-09-21 18:50:40
【问题描述】:
我正在阅读以下网页中的示例 1:
http://www.programcreek.com/java-api-examples/index.php?api=javax.jms.QueueBrowser
行内:
QueueBrowser browser = session.createBrowser(queue1);
在哪里
queue1
定义了吗?
这是我打开和关闭连接的示例:
public static void main(String[] args) throws Exception {
Logger logger = LoggerFactory.getLogger(Connection.class);
String hostname = "xxxxxx";
int port = 1442;
String queueManager = "xxxxxxxx";
String channel = "xxxxxxxxxx";
String queueName = "xxxxxxxxxx";
String keystore = "xxxxxxxxx/xxxxxxx/ssclient_test.ks";
String truststore = "cxxxxxx/xxxxxxxx/client_test.ts";
String suiteName = "xxx_xxx_xxxx_xxx_xxx_xxx";
String keyStorePassKey = "xxx_KEYSTORE";
SSLSocketFactory sslSocketFactory = createSslSocketFactory(new File(keystore), new File(truststore),
keyStorePassKey);
MQXAQueueConnectionFactory mqConnFactory = new MQXAQueueConnectionFactory();
mqConnFactory.setHostName(hostname);
mqConnFactory.setPort(port);
mqConnFactory.setTransportType(JMSC.MQJMS_TP_CLIENT_MQ_TCPIP);
mqConnFactory.setQueueManager(queueManager);
mqConnFactory.setChannel(channel);
mqConnFactory.setUseConnectionPooling(true);
mqConnFactory.setSSLSocketFactory(sslSocketFactory);
mqConnFactory.setSSLCipherSuite(suiteName);
QueueConnection queueConnection = mqConnFactory.createQueueConnection();
QueueSession queueSession = queueConnection.createQueueSession(false, Session.AUTO_ACKNOWLEDGE);
queueSession.close();
queueConnection.close();
}
在这种情况下我将如何定义队列?
【问题讨论】: