Java Code Examples for org.springframework.amqp.rabbit.connection.CachingConnectionFactory#setAddresses()
The following examples show how to use
org.springframework.amqp.rabbit.connection.CachingConnectionFactory#setAddresses() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: RabbitConnectionFactoryCreator.java From spring-cloud-connectors with Apache License 2.0 | 6 votes |
private CachingConnectionFactory createSpringConnectionFactory(AmqpServiceInfo serviceInfo, ServiceConnectorConfig serviceConnectorConfiguration, com.rabbitmq.client.ConnectionFactory connectionFactory) { CachingConnectionFactory cachingConnectionFactory = new CachingConnectionFactory(connectionFactory); if (serviceInfo.getUris() != null) { cachingConnectionFactory.setAddresses(getAddresses(serviceInfo)); } if (serviceConnectorConfiguration != null) { Integer channelCacheSize = ((RabbitConnectionFactoryConfig) serviceConnectorConfiguration).getChannelCacheSize(); if (channelCacheSize != null) { cachingConnectionFactory.setChannelCacheSize(channelCacheSize); } } return cachingConnectionFactory; }
Example 2
Source File: RabbitMQConfig.java From kkbinlog with Apache License 2.0 | 5 votes |
@Bean public ConnectionFactory connectionFactory() { CachingConnectionFactory factory = new CachingConnectionFactory(); factory.setAddresses(host + ":" + port); factory.setVirtualHost(virtualHost); factory.setUsername(username); factory.setPassword(password); return factory; }
Example 3
Source File: RabbitMQConfig.java From kkbinlog with Apache License 2.0 | 5 votes |
@Bean public ConnectionFactory connectionFactory() { CachingConnectionFactory factory = new CachingConnectionFactory(); factory.setAddresses(host + ":" + port); factory.setVirtualHost(virtualHost); factory.setUsername(username); factory.setPassword(password); return factory; }
Example 4
Source File: RabbitMQConfig.java From kkbinlog with Apache License 2.0 | 5 votes |
@Bean public ConnectionFactory connectionFactory() { CachingConnectionFactory factory = new CachingConnectionFactory(); factory.setAddresses(host + ":" + port); factory.setVirtualHost(virtualHost); factory.setUsername(username); factory.setPassword(password); return factory; }
Example 5
Source File: RabbitServiceAutoConfiguration.java From spring-cloud-stream-binder-rabbit with Apache License 2.0 | 5 votes |
static void configureCachingConnectionFactory( CachingConnectionFactory connectionFactory, ConfigurableApplicationContext applicationContext, RabbitProperties rabbitProperties) throws Exception { if (StringUtils.hasText(rabbitProperties.getAddresses())) { connectionFactory.setAddresses(rabbitProperties.determineAddresses()); } connectionFactory.setPublisherConfirmType(rabbitProperties.getPublisherConfirmType() == null ? ConfirmType.NONE : rabbitProperties.getPublisherConfirmType()); 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().toMillis()); } connectionFactory.setApplicationContext(applicationContext); applicationContext.addApplicationListener(connectionFactory); connectionFactory.afterPropertiesSet(); }
Example 6
Source File: RabbitAutoConfiguration.java From summerframework with Apache License 2.0 | 4 votes |
@Bean public CachingConnectionFactory rabbitConnectionFactory(RabbitProperties config) throws Exception { RabbitConnectionFactoryBean factory = new RabbitConnectionFactoryBean(); if (config.determineHost() != null) { factory.setHost(config.determineHost()); } factory.setPort(config.determinePort()); 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; }