本文整理汇总了Java中org.apache.activemq.artemis.jms.client.ActiveMQConnectionFactory.setPassword方法的典型用法代码示例。如果您正苦于以下问题:Java ActiveMQConnectionFactory.setPassword方法的具体用法?Java ActiveMQConnectionFactory.setPassword怎么用?Java ActiveMQConnectionFactory.setPassword使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.activemq.artemis.jms.client.ActiveMQConnectionFactory
的用法示例。
在下文中一共展示了ActiveMQConnectionFactory.setPassword方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createConnectionFactory
import org.apache.activemq.artemis.jms.client.ActiveMQConnectionFactory; //导入方法依赖的package包/类
/**
*
* @param config
* @return
* @throws Exception
*/
private static ActiveMQConnectionFactory createConnectionFactory(BrokerConfig config) throws Exception {
Map<String, Object> params = Collections.singletonMap(
org.apache.activemq.artemis.core.remoting.impl.invm.TransportConstants.SERVER_ID_PROP_NAME, "1");
final ActiveMQConnectionFactory connectionFactory;
if (config.getUrl() != null) {
connectionFactory = ActiveMQJMSClient.createConnectionFactory(config.getUrl(), null);
} else {
if (config.getHost() != null) {
params.put(TransportConstants.HOST_PROP_NAME, config.getHost());
params.put(TransportConstants.PORT_PROP_NAME, config.getPort());
}
if (config.isHa()) {
connectionFactory = ActiveMQJMSClient.createConnectionFactoryWithHA(JMSFactoryType.CF, new TransportConfiguration(config.getConnectorFactory(), params));
} else {
connectionFactory = ActiveMQJMSClient.createConnectionFactoryWithoutHA(JMSFactoryType.CF, new TransportConfiguration(config.getConnectorFactory(), params));
}
}
if (config.isSecurityEnabled()) {
connectionFactory.setUser(config.getUsername());
connectionFactory.setPassword(config.getPassword());
}
return connectionFactory.disableFinalizeChecks();
}
示例2: createConnectionFactory
import org.apache.activemq.artemis.jms.client.ActiveMQConnectionFactory; //导入方法依赖的package包/类
private ActiveMQConnectionFactory createConnectionFactory() throws Exception {
Map<String, Object> params = new HashMap<>();
params.put(org.apache.activemq.artemis.core.remoting.impl.invm.TransportConstants.SERVER_ID_PROP_NAME, "1");
final ActiveMQConnectionFactory activeMQConnectionFactory;
if (configuration.getUrl() != null) {
activeMQConnectionFactory = ActiveMQJMSClient.createConnectionFactory(configuration.getUrl(), null);
} else {
if (configuration.getHost() != null) {
params.put(TransportConstants.HOST_PROP_NAME, configuration.getHost());
params.put(TransportConstants.PORT_PROP_NAME, configuration.getPort());
}
if (configuration.isHa()) {
activeMQConnectionFactory = ActiveMQJMSClient.createConnectionFactoryWithHA(JMSFactoryType.CF, new TransportConfiguration(configuration.getConnectorFactory(), params));
} else {
activeMQConnectionFactory = ActiveMQJMSClient.createConnectionFactoryWithoutHA(JMSFactoryType.CF, new TransportConfiguration(configuration.getConnectorFactory(), params));
}
}
if (configuration.hasAuthentication()) {
activeMQConnectionFactory.setUser(configuration.getUsername());
activeMQConnectionFactory.setPassword(configuration.getPassword());
}
// The CF will probably be GCed since it was injected, so we disable the finalize check
return activeMQConnectionFactory.disableFinalizeChecks();
}