本文整理汇总了Java中com.ibm.mq.constants.MQConstants类的典型用法代码示例。如果您正苦于以下问题:Java MQConstants类的具体用法?Java MQConstants怎么用?Java MQConstants使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
MQConstants类属于com.ibm.mq.constants包,在下文中一共展示了MQConstants类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: runSample
import com.ibm.mq.constants.MQConstants; //导入依赖的package包/类
public void runSample() {
//System.setProperty("javax.net.debug", "true");
/****************************************************************/
/* Utilise the arguments */
/****************************************************************/
System.setProperty("javax.net.ssl.trustStore", sslkeyr );
System.setProperty("javax.net.ssl.keyStore", sslkeyr );
System.setProperty("javax.net.ssl.keyStorePassword", sslpass );
MQEnvironment.hostname = conname;
MQEnvironment.port = Integer.parseInt(port);
MQEnvironment.channel = channel;
MQEnvironment.properties.put(MQConstants.SSL_CIPHER_SUITE_PROPERTY,sslciph);
/****************************************************************/
/* Print out parms */
/****************************************************************/
System.out.println("Connecting to:");
System.out.println(" Conname = " + MQEnvironment.hostname);
System.out.println(" Port = " + MQEnvironment.port);
System.out.println(" Channel = " + MQEnvironment.channel);
System.out.println(" Qmgr = " + qmgr);
System.out.println(" SSLCiph = "+ MQEnvironment.properties.get(MQConstants.SSL_CIPHER_SUITE_PROPERTY));
System.out.println(" SSLTrustStore = "+ System.getProperty("javax.net.ssl.trustStore"));
System.out.println(" SSLKeyStore = "+ System.getProperty("javax.net.ssl.keyStore"));
System.out.println(" SSLKeyStorePassword = "+ System.getProperty("javax.net.ssl.keyStorePassword"));
try {
/**************************************************************/
/* Connect to queue manager */
/**************************************************************/
System.out.println("Connecting...");
MQQueueManager qMgr = new MQQueueManager(qmgr);
System.out.println("Connection successful!");
/**************************************************************/
/* Disconnect from queue manager */
/**************************************************************/
System.out.println("Disconnecting from the Queue Manager");
qMgr.disconnect();
System.out.println("Done!");
}
catch (MQException ex) {
System.out.println("A WebSphere MQ Error occured : Completion Code "
+ ex.completionCode + " Reason Code " + ex.reasonCode);
}
}
开发者ID:ibm-messaging,项目名称:mq-tls-ssl-wizard,代码行数:49,代码来源:SSLSample.java
示例2: handleException
import com.ibm.mq.constants.MQConstants; //导入依赖的package包/类
/**
* Handles exceptions from MQ. Some JMS exceptions are treated as retriable meaning that the
* connector can keep running and just trying again is likely to fix things.
*
* @throws RetriableException Operation failed, but connector should continue to retry.
* @throws ConnectException Operation failed and connector should stop.
*/
private void handleException(Throwable exc) throws ConnectException, RetriableException {
boolean isRetriable = false;
boolean mustClose = true;
int reason = -1;
// Try to extract the MQ reason code to see if it's a retriable exception
Throwable t = exc.getCause();
while (t != null) {
if (t instanceof MQException) {
MQException mqe = (MQException)t;
log.error("MQ error: CompCode {}, Reason {}", mqe.getCompCode(), mqe.getReason());
reason = mqe.getReason();
break;
}
t = t.getCause();
}
switch (reason)
{
// These reason codes indicate that the connection needs to be closed, but just retrying later
// will probably recover
case MQConstants.MQRC_BACKED_OUT:
case MQConstants.MQRC_CHANNEL_NOT_AVAILABLE:
case MQConstants.MQRC_CONNECTION_BROKEN:
case MQConstants.MQRC_HOST_NOT_AVAILABLE:
case MQConstants.MQRC_NOT_AUTHORIZED:
case MQConstants.MQRC_Q_MGR_NOT_AVAILABLE:
case MQConstants.MQRC_Q_MGR_QUIESCING:
case MQConstants.MQRC_Q_MGR_STOPPING:
case MQConstants.MQRC_UNEXPECTED_ERROR:
isRetriable = true;
break;
// These reason codes indicates that the connect is still OK, but just retrying later
// will probably recover - possibly with administrative action on the queue manager
case MQConstants.MQRC_Q_FULL:
case MQConstants.MQRC_PUT_INHIBITED:
isRetriable = true;
mustClose = false;
break;
}
if (mustClose) {
close();
}
if (isRetriable) {
throw new RetriableException(exc);
}
throw new ConnectException(exc);
}
开发者ID:ibm-messaging,项目名称:kafka-connect-mq-sink,代码行数:59,代码来源:JMSWriter.java
示例3: handleException
import com.ibm.mq.constants.MQConstants; //导入依赖的package包/类
/**
* Handles exceptions from MQ. Some JMS exceptions are treated as retriable meaning that the
* connector can keep running and just trying again is likely to fix things.
*/
private void handleException(Throwable exc) throws ConnectException, RetriableException {
boolean isRetriable = false;
boolean mustClose = true;
int reason = -1;
// Try to extract the MQ reason code to see if it's a retriable exception
Throwable t = exc.getCause();
while (t != null) {
if (t instanceof MQException) {
MQException mqe = (MQException)t;
log.error("MQ error: CompCode {}, Reason {} {}", mqe.getCompCode(), mqe.getReason(),
MQConstants.lookupReasonCode(mqe.getReason()));
reason = mqe.getReason();
break;
}
t = t.getCause();
}
switch (reason)
{
// These reason codes indicate that the connection needs to be closed, but just retrying later
// will probably recover
case MQConstants.MQRC_BACKED_OUT:
case MQConstants.MQRC_CHANNEL_NOT_AVAILABLE:
case MQConstants.MQRC_CONNECTION_BROKEN:
case MQConstants.MQRC_HOST_NOT_AVAILABLE:
case MQConstants.MQRC_NOT_AUTHORIZED:
case MQConstants.MQRC_Q_MGR_NOT_AVAILABLE:
case MQConstants.MQRC_Q_MGR_QUIESCING:
case MQConstants.MQRC_Q_MGR_STOPPING:
case MQConstants.MQRC_UNEXPECTED_ERROR:
isRetriable = true;
break;
// These reason codes indicates that the connect is still OK, but just retrying later
// will probably recover - possibly with administrative action on the queue manager
case MQConstants.MQRC_GET_INHIBITED:
isRetriable = true;
mustClose = false;
break;
}
if (mustClose) {
closeInternal();
}
if (isRetriable) {
throw new RetriableException(exc);
}
throw new ConnectException(exc);
}
开发者ID:ibm-messaging,项目名称:kafka-connect-mq-source,代码行数:56,代码来源:JMSReader.java
示例4: MQAccessor
import com.ibm.mq.constants.MQConstants; //导入依赖的package包/类
public MQAccessor(final String qManager, final String qName, final int port, final String channelname,
final String hostname, final String usr, final String pwd) {
mqEnv = new HashMap<String, Object>();
mqEnv.put(MQConstants.USE_MQCSP_AUTHENTICATION_PROPERTY, false);
mqEnv.put(CMQC.CHANNEL_PROPERTY, channelname);
mqEnv.put(CMQC.HOST_NAME_PROPERTY, hostname);
mqEnv.put(CMQC.PORT_PROPERTY, new Integer(port)); // the CASE-SENSITIVE
if(StringUtils.isNotEmpty(usr) && StringUtils.isNotEmpty(pwd)) {
mqEnv.put(MQConstants.USE_MQCSP_AUTHENTICATION_PROPERTY, true);
mqEnv.put(CMQC.USER_ID_PROPERTY, usr);
mqEnv.put(CMQC.PASSWORD_PROPERTY, pwd);
}
this.qManager = qManager;
this.qName = qName;
this.qOption = QueueOption.GenerateMsgId;
}
开发者ID:rockitconsulting,项目名称:test.rockitizer,代码行数:22,代码来源:MQAccessor.java
注:本文中的com.ibm.mq.constants.MQConstants类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论