Java Code Examples for org.springframework.amqp.rabbit.connection.RabbitConnectionFactoryBean#setPort()
The following examples show how to use
org.springframework.amqp.rabbit.connection.RabbitConnectionFactoryBean#setPort() .
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: EventRegistryRabbitConfiguration.java From flowable-engine with Apache License 2.0 | 6 votes |
@Bean public CachingConnectionFactory rabbitConnectionFactory(RabbitMQContainer rabbitMQContainer) throws Exception { // configuration properties are Spring Boot defaults RabbitConnectionFactoryBean rabbitFactory = new RabbitConnectionFactoryBean(); rabbitFactory.setPort(rabbitMQContainer.getAmqpPort()); rabbitFactory.afterPropertiesSet(); CachingConnectionFactory factory = new CachingConnectionFactory(rabbitFactory.getObject()); return factory; }
Example 2
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; }