MQ 重新连接不适用于 Wildfly。如何正确配置?
MQ reconnect does not work with Wildfly. How to configure it correctly?
MQ 重新连接不起作用。你能建议修复它的方法吗?
我用的是 Wildfly 12.0.0.Final
Driver 是 wmq.jmsra-9.1.2.0.rar
尝试使用这种方式配置重连
第一个
<subsystem xmlns="urn:jboss:domain:resource-adapters:5.0">
<resource-adapters>
<resource-adapter id="wmq.jmsra.rar" statistics-enabled="false">
<archive>
wmq.jmsra-9.1.2.0.rar
</archive>
<transaction-support>NoTransaction</transaction-support>
<config-property name="startupRetryInterval">
300
</config-property>
<config-property name="reconnectionRetryCount">
9000
</config-property>
<config-property name="startupRetryCount">
9000
</config-property>
<config-property name="reconnectionRetryInterval">
300
</config-property>
</resource-adapter>
</resource-adapters>
</subsystem>
第二个(最后两个属性)
private JMSContext createJmsContext() throws JMSException {
JmsConnectionFactory cf;
JmsFactoryFactory ff = JmsFactoryFactory.getInstance(WMQConstants.WMQ_PROVIDER);
cf = ff.createConnectionFactory();
cf.setStringProperty(WMQConstants.WMQ_HOST_NAME, props.getProperty(Q_HOST));
cf.setIntProperty(WMQConstants.WMQ_PORT, Integer.valueOf(props.getProperty(Q_PORT)));
cf.setStringProperty(WMQConstants.WMQ_CHANNEL, props.getProperty(Q_CHANNEL));
cf.setIntProperty(WMQConstants.WMQ_CONNECTION_MODE, WMQConstants.WMQ_CM_CLIENT);
cf.setStringProperty(WMQConstants.WMQ_QUEUE_MANAGER, props.getProperty(Q_MANAGER));
cf.setStringProperty(WMQConstants.WMQ_APPLICATIONNAME, "JmsPutGet (JMS)");
cf.setBooleanProperty(WMQConstants.USER_AUTHENTICATION_MQCSP, true);
cf.setIntProperty(WMQConstants.WMQ_CLIENT_RECONNECT_OPTIONS, WMQConstants.WMQ_CLIENT_RECONNECT_Q_MGR);
cf.setIntProperty(WMQConstants.WMQ_CLIENT_RECONNECT_TIMEOUT, 60000);
return cf.createContext();
}
IBM MQ 类 for JMS 资源适配器不支持自动 JMS 客户端重新连接。
查看 IBM MQ v9.1 知识中心页面 Developing applications>Developing JMS and Java applications>Using IBM MQ classes for JMS>Writing IBM MQ classes for JMS applications>Accessing IBM MQ features from an IBM MQ classes for JMS application:
The use of this implementation of automatic client reconnection is not supported within Java™ Platform, Enterprise Edition application servers. See Using automatic client reconnection in Java EE environments for an alternative implementation.
Note
Automatic client reconnection with activation specifications using the functionality provided by IBM MQ classes for JMS is not supported. The IBM MQ resource adapter provides its own mechanism for reconnecting activation specifications if the queue manager that the activation specification was connecting to becomes unavailable.
MQ 重新连接不起作用。你能建议修复它的方法吗?
我用的是 Wildfly 12.0.0.Final
Driver 是 wmq.jmsra-9.1.2.0.rar
尝试使用这种方式配置重连
第一个
<subsystem xmlns="urn:jboss:domain:resource-adapters:5.0">
<resource-adapters>
<resource-adapter id="wmq.jmsra.rar" statistics-enabled="false">
<archive>
wmq.jmsra-9.1.2.0.rar
</archive>
<transaction-support>NoTransaction</transaction-support>
<config-property name="startupRetryInterval">
300
</config-property>
<config-property name="reconnectionRetryCount">
9000
</config-property>
<config-property name="startupRetryCount">
9000
</config-property>
<config-property name="reconnectionRetryInterval">
300
</config-property>
</resource-adapter>
</resource-adapters>
</subsystem>
第二个(最后两个属性)
private JMSContext createJmsContext() throws JMSException {
JmsConnectionFactory cf;
JmsFactoryFactory ff = JmsFactoryFactory.getInstance(WMQConstants.WMQ_PROVIDER);
cf = ff.createConnectionFactory();
cf.setStringProperty(WMQConstants.WMQ_HOST_NAME, props.getProperty(Q_HOST));
cf.setIntProperty(WMQConstants.WMQ_PORT, Integer.valueOf(props.getProperty(Q_PORT)));
cf.setStringProperty(WMQConstants.WMQ_CHANNEL, props.getProperty(Q_CHANNEL));
cf.setIntProperty(WMQConstants.WMQ_CONNECTION_MODE, WMQConstants.WMQ_CM_CLIENT);
cf.setStringProperty(WMQConstants.WMQ_QUEUE_MANAGER, props.getProperty(Q_MANAGER));
cf.setStringProperty(WMQConstants.WMQ_APPLICATIONNAME, "JmsPutGet (JMS)");
cf.setBooleanProperty(WMQConstants.USER_AUTHENTICATION_MQCSP, true);
cf.setIntProperty(WMQConstants.WMQ_CLIENT_RECONNECT_OPTIONS, WMQConstants.WMQ_CLIENT_RECONNECT_Q_MGR);
cf.setIntProperty(WMQConstants.WMQ_CLIENT_RECONNECT_TIMEOUT, 60000);
return cf.createContext();
}
IBM MQ 类 for JMS 资源适配器不支持自动 JMS 客户端重新连接。
查看 IBM MQ v9.1 知识中心页面 Developing applications>Developing JMS and Java applications>Using IBM MQ classes for JMS>Writing IBM MQ classes for JMS applications>Accessing IBM MQ features from an IBM MQ classes for JMS application:
The use of this implementation of automatic client reconnection is not supported within Java™ Platform, Enterprise Edition application servers. See Using automatic client reconnection in Java EE environments for an alternative implementation.
Note
Automatic client reconnection with activation specifications using the functionality provided by IBM MQ classes for JMS is not supported. The IBM MQ resource adapter provides its own mechanism for reconnecting activation specifications if the queue manager that the activation specification was connecting to becomes unavailable.