Java Code Examples for org.springframework.amqp.rabbit.connection.CachingConnectionFactory#setHost()

The following examples show how to use org.springframework.amqp.rabbit.connection.CachingConnectionFactory#setHost() . 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: AmqpTestConfiguration.java    From hawkbit with Eclipse Public License 1.0 6 votes vote down vote up
@Bean
ConnectionFactory rabbitConnectionFactory(final RabbitMqSetupService rabbitmqSetupService) {
    final CachingConnectionFactory factory = new CachingConnectionFactory();
    factory.setHost(rabbitmqSetupService.getHostname());
    factory.setPort(5672);
    factory.setUsername(rabbitmqSetupService.getUsername());
    factory.setPassword(rabbitmqSetupService.getPassword());
    try {
        factory.setVirtualHost(rabbitmqSetupService.createVirtualHost());
        // All exception are catched. The BrokerRunning decide if the
        // test should break or not
    } catch (@SuppressWarnings("squid:S2221") final Exception e) {
        Throwables.propagateIfInstanceOf(e, AlivenessException.class);
        LOG.error("Cannot create virtual host.", e);
    }
    return factory;
}
 
Example 2
Source File: RabbitMQConfiguration.java    From Learning-Path-Spring-5-End-to-End-Programming with MIT License 5 votes vote down vote up
@Bean("springConnectionFactory")
public ConnectionFactory connectionFactory() {
  CachingConnectionFactory factory = new CachingConnectionFactory();
  factory.setUsername(this.user);
  factory.setPassword(this.pass);
  factory.setHost(this.host);
  factory.setPort(this.port);
  return factory;
}
 
Example 3
Source File: RabbitMQConfiguration.java    From Learning-Path-Spring-5-End-to-End-Programming with MIT License 5 votes vote down vote up
@Bean("springConnectionFactory")
public ConnectionFactory connectionFactory() {
  CachingConnectionFactory factory = new CachingConnectionFactory();
  factory.setUsername(this.user);
  factory.setPassword(this.pass);
  factory.setHost(this.host);
  factory.setPort(this.port);
  return factory;
}
 
Example 4
Source File: RabbitConfig.java    From notes with Apache License 2.0 5 votes vote down vote up
/**
 * 注入
 *
 * @param
 * @return com.rabbitmq.client.Connection
 * @author fruiqi
 * @date 19-1-22 下午5:41
 **/
@Bean
public ConnectionFactory getConnection() throws Exception {
    CachingConnectionFactory factory = new CachingConnectionFactory();
    factory.setUsername(userName);
    factory.setPassword(userPassword);
    factory.setHost(host);
    factory.setPort(port);
    return factory;
}
 
Example 5
Source File: RabbitMQConfiguration.java    From Spring-5.0-By-Example with MIT License 5 votes vote down vote up
@Bean("springConnectionFactory")
public ConnectionFactory connectionFactory() {
  CachingConnectionFactory factory = new CachingConnectionFactory();
  factory.setUsername(this.user);
  factory.setPassword(this.pass);
  factory.setHost(this.host);
  factory.setPort(this.port);
  return factory;
}