当前位置: 首页>>代码示例>>Java>>正文


Java ActiveMQConnectionFactory.setPassword方法代码示例

本文整理汇总了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();
}
 
开发者ID:dansiviter,项目名称:cito,代码行数:30,代码来源:BrokerProvider.java

示例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();
}
 
开发者ID:apache,项目名称:activemq-artemis,代码行数:25,代码来源:ConnectionFactoryProvider.java


注:本文中的org.apache.activemq.artemis.jms.client.ActiveMQConnectionFactory.setPassword方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。