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


Java ActiveMQConnectionFactory.setUserName方法代码示例

本文整理汇总了Java中org.apache.activemq.ActiveMQConnectionFactory.setUserName方法的典型用法代码示例。如果您正苦于以下问题:Java ActiveMQConnectionFactory.setUserName方法的具体用法?Java ActiveMQConnectionFactory.setUserName怎么用?Java ActiveMQConnectionFactory.setUserName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.activemq.ActiveMQConnectionFactory的用法示例。


在下文中一共展示了ActiveMQConnectionFactory.setUserName方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: connectionFactory

import org.apache.activemq.ActiveMQConnectionFactory; //导入方法依赖的package包/类
@Bean(name="connectionFactory")
	public ConnectionFactory connectionFactory(){
		ActiveMQConnectionFactory activeMQConnectionFactory = new ActiveMQConnectionFactory();
//		activeMQConnectionFactory.setUseAsyncSend(true);
		activeMQConnectionFactory.setUserName(jmsUserName);
		activeMQConnectionFactory.setPassword(jmsPassword);
		activeMQConnectionFactory.setBrokerURL(jmsBrokerUrl);

		// 默认重复投递6次将转发到死信队列,改为无限次数
//		RedeliveryPolicy redeliveryPolicy = new RedeliveryPolicy();
//		redeliveryPolicy.setMaximumRedeliveries(-1);
//		
//		activeMQConnectionFactory.setRedeliveryPolicy(redeliveryPolicy);
		
		PooledConnectionFactory pooledConnectionFactory = new PooledConnectionFactory(activeMQConnectionFactory);
		pooledConnectionFactory.setMaxConnections(jmsMaxPooledConnections);
//		CachingConnectionFactory cachingConnectionFactory = new CachingConnectionFactory(pooledConnectionFactory);
//		cachingConnectionFactory.setSessionCacheSize(10);
		return pooledConnectionFactory;
	}
 
开发者ID:eXcellme,项目名称:eds,代码行数:21,代码来源:EdsCamelConfig.java

示例2: buildOpsMQListenerContainer

import org.apache.activemq.ActiveMQConnectionFactory; //导入方法依赖的package包/类
private SensorListenerContainer buildOpsMQListenerContainer(String host) {
	
	int port = Integer.valueOf(System.getProperty(OPSMQ_PORT_PARAM, "61616"));
	String opsmqPass = System.getenv(OPSMQ_PASS_ENV_VAR);
	if (opsmqPass == null) {
		throw new RuntimeException(OPSMQ_PASS_ENV_VAR + " env var needs to be set!");
	}

	ActiveMQConnectionFactory opsmqConnectionFactory = new ActiveMQConnectionFactory();
	opsmqConnectionFactory.setBrokerURL(opsMQURI.build(host, port));
	opsmqConnectionFactory.setUserName(OPSMQ_USER);
	opsmqConnectionFactory.setPassword(opsmqPass);
	
	SensorListenerContainer listenerContainer = new SensorListenerContainer();
	
	listenerContainer.setConnectionFactory(opsmqConnectionFactory);
	listenerContainer.setMaxConcurrentConsumers(Integer.valueOf(System.getProperty(OPSMQ_MAX_SESSIONS, "24")));
	listenerContainer.setConcurrentConsumers(Integer.valueOf(System.getProperty(OPSMQ_MAX_SESSIONS, "24")));
	listenerContainer.setSessionAcknowledgeMode(Session.AUTO_ACKNOWLEDGE);
	listenerContainer.setMessageListener(this.sensorListener);
	
	return listenerContainer;
	
}
 
开发者ID:oneops,项目名称:oneops,代码行数:25,代码来源:InstanceManager.java

示例3: connect

import org.apache.activemq.ActiveMQConnectionFactory; //导入方法依赖的package包/类
public void connect() throws JMSException {
  LOG.info("Connecting to broker {} on user {}", brokerURL, username);
  final ActiveMQConnectionFactory connectionFactory = new ActiveMQConnectionFactory(brokerURL);
  connectionFactory.setUserName(username);
  connectionFactory.setPassword(password);
  connectionFactory.setTrustAllPackages(true);
  connection = connectionFactory.createConnection();
  connection.start();
}
 
开发者ID:Cognifide,项目名称:aet,代码行数:10,代码来源:DefaultJmsConnection.java


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