當前位置: 首頁>>代碼示例>>Java>>正文


Java CachingConnectionFactory.setCacheMode方法代碼示例

本文整理匯總了Java中org.springframework.amqp.rabbit.connection.CachingConnectionFactory.setCacheMode方法的典型用法代碼示例。如果您正苦於以下問題:Java CachingConnectionFactory.setCacheMode方法的具體用法?Java CachingConnectionFactory.setCacheMode怎麽用?Java CachingConnectionFactory.setCacheMode使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.springframework.amqp.rabbit.connection.CachingConnectionFactory的用法示例。


在下文中一共展示了CachingConnectionFactory.setCacheMode方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: configureCachingConnectionFactory

import org.springframework.amqp.rabbit.connection.CachingConnectionFactory; //導入方法依賴的package包/類
static void configureCachingConnectionFactory(CachingConnectionFactory connectionFactory,
		ConfigurableApplicationContext applicationContext, RabbitProperties rabbitProperties) throws Exception {

	if (StringUtils.hasText(rabbitProperties.getAddresses())) {
		connectionFactory.setAddresses(rabbitProperties.determineAddresses());
	}

	connectionFactory.setPublisherConfirms(rabbitProperties.isPublisherConfirms());
	connectionFactory.setPublisherReturns(rabbitProperties.isPublisherReturns());
	if (rabbitProperties.getCache().getChannel().getSize() != null) {
		connectionFactory.setChannelCacheSize(rabbitProperties.getCache().getChannel().getSize());
	}
	if (rabbitProperties.getCache().getConnection().getMode() != null) {
		connectionFactory.setCacheMode(rabbitProperties.getCache().getConnection().getMode());
	}
	if (rabbitProperties.getCache().getConnection().getSize() != null) {
		connectionFactory.setConnectionCacheSize(
				rabbitProperties.getCache().getConnection().getSize());
	}
	if (rabbitProperties.getCache().getChannel().getCheckoutTimeout() != null) {
		connectionFactory.setChannelCheckoutTimeout(
				rabbitProperties.getCache().getChannel().getCheckoutTimeout());
	}
	connectionFactory.setApplicationContext(applicationContext);
	applicationContext.addApplicationListener(connectionFactory);
	connectionFactory.afterPropertiesSet();
}
 
開發者ID:spring-cloud,項目名稱:spring-cloud-stream-binder-rabbit,代碼行數:28,代碼來源:RabbitServiceAutoConfiguration.java

示例2: rabbitConnectionFactory

import org.springframework.amqp.rabbit.connection.CachingConnectionFactory; //導入方法依賴的package包/類
@Bean
public CachingConnectionFactory rabbitConnectionFactory(RabbitProperties config)
		throws Exception {
	RabbitConnectionFactoryBean factory = new RabbitConnectionFactoryBean();
	if (config.determineHost() != null) {
		factory.setHost(config.determineHost());
	}
	factory.setPort(config.determinePort());
	factory.setHost(config.determineHost());
	if (config.determineUsername() != null) {
		factory.setUsername(config.determineUsername());
	}
	if (config.determinePassword() != null) {
		factory.setPassword(config.determinePassword());
	}
	if (config.determineVirtualHost() != null) {
		factory.setVirtualHost(config.determineVirtualHost());
	}
	if (config.getRequestedHeartbeat() != null) {
		factory.setRequestedHeartbeat(config.getRequestedHeartbeat());
	}
	RabbitProperties.Ssl ssl = config.getSsl();
	if (ssl.isEnabled()) {
		factory.setUseSSL(true);
		if (ssl.getAlgorithm() != null) {
			factory.setSslAlgorithm(ssl.getAlgorithm());
		}
		factory.setKeyStore(ssl.getKeyStore());
		factory.setKeyStorePassphrase(ssl.getKeyStorePassword());
		factory.setTrustStore(ssl.getTrustStore());
		factory.setTrustStorePassphrase(ssl.getTrustStorePassword());
	}
	if (config.getConnectionTimeout() != null) {
		factory.setConnectionTimeout(config.getConnectionTimeout());
	}
	factory.afterPropertiesSet();
	CachingConnectionFactory connectionFactory = new CachingConnectionFactory(
			factory.getObject());
	connectionFactory.setAddresses(config.determineAddresses());
	connectionFactory.setPublisherConfirms(config.isPublisherConfirms());
	connectionFactory.setPublisherReturns(config.isPublisherReturns());
	if (config.getCache().getChannel().getSize() != null) {
		connectionFactory
				.setChannelCacheSize(config.getCache().getChannel().getSize());
	}
	if (config.getCache().getConnection().getMode() != null) {
		connectionFactory
				.setCacheMode(config.getCache().getConnection().getMode());
	}
	if (config.getCache().getConnection().getSize() != null) {
		connectionFactory.setConnectionCacheSize(
				config.getCache().getConnection().getSize());
	}
	if (config.getCache().getChannel().getCheckoutTimeout() != null) {
		connectionFactory.setChannelCheckoutTimeout(
				config.getCache().getChannel().getCheckoutTimeout());
	}
	return connectionFactory;
}
 
開發者ID:vikrammane23,項目名稱:https-github.com-g0t4-jenkins2-course-spring-boot,代碼行數:60,代碼來源:RabbitAutoConfiguration.java

示例3: rabbitConnectionFactory

import org.springframework.amqp.rabbit.connection.CachingConnectionFactory; //導入方法依賴的package包/類
@Bean
public CachingConnectionFactory rabbitConnectionFactory(RabbitProperties config)
		throws Exception {
	RabbitConnectionFactoryBean factory = new RabbitConnectionFactoryBean();
	if (config.getHost() != null) {
		factory.setHost(config.getHost());
		factory.setPort(config.getPort());
	}
	if (config.getUsername() != null) {
		factory.setUsername(config.getUsername());
	}
	if (config.getPassword() != null) {
		factory.setPassword(config.getPassword());
	}
	if (config.getVirtualHost() != null) {
		factory.setVirtualHost(config.getVirtualHost());
	}
	if (config.getRequestedHeartbeat() != null) {
		factory.setRequestedHeartbeat(config.getRequestedHeartbeat());
	}
	RabbitProperties.Ssl ssl = config.getSsl();
	if (ssl.isEnabled()) {
		factory.setUseSSL(true);
		if (ssl.getAlgorithm() != null) {
			factory.setSslAlgorithm(ssl.getAlgorithm());
		}
		factory.setKeyStore(ssl.getKeyStore());
		factory.setKeyStorePassphrase(ssl.getKeyStorePassword());
		factory.setTrustStore(ssl.getTrustStore());
		factory.setTrustStorePassphrase(ssl.getTrustStorePassword());
	}
	if (config.getConnectionTimeout() != null) {
		factory.setConnectionTimeout(config.getConnectionTimeout());
	}
	factory.afterPropertiesSet();
	CachingConnectionFactory connectionFactory = new CachingConnectionFactory(
			factory.getObject());
	connectionFactory.setAddresses(config.getAddresses());
	connectionFactory.setPublisherConfirms(config.isPublisherConfirms());
	connectionFactory.setPublisherReturns(config.isPublisherReturns());
	if (config.getCache().getChannel().getSize() != null) {
		connectionFactory
				.setChannelCacheSize(config.getCache().getChannel().getSize());
	}
	if (config.getCache().getConnection().getMode() != null) {
		connectionFactory
				.setCacheMode(config.getCache().getConnection().getMode());
	}
	if (config.getCache().getConnection().getSize() != null) {
		connectionFactory.setConnectionCacheSize(
				config.getCache().getConnection().getSize());
	}
	if (config.getCache().getChannel().getCheckoutTimeout() != null) {
		connectionFactory.setChannelCheckoutTimeout(
				config.getCache().getChannel().getCheckoutTimeout());
	}
	return connectionFactory;
}
 
開發者ID:philwebb,項目名稱:spring-boot-concourse,代碼行數:59,代碼來源:RabbitAutoConfiguration.java


注:本文中的org.springframework.amqp.rabbit.connection.CachingConnectionFactory.setCacheMode方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。