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

The following examples show how to use org.springframework.amqp.rabbit.connection.CachingConnectionFactory#setVirtualHost() . 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: RabbitMQConfig.java    From kkbinlog with Apache License 2.0 5 votes vote down vote up
@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 vote down vote up
@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 vote down vote up
@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: AmqpConfiguration.java    From hawkbit-examples with Eclipse Public License 1.0 4 votes vote down vote up
CachingConnectionFactoryInitializer(final CachingConnectionFactory connectionFactory,
        final AmqpProperties amqpProperties) {
    connectionFactory.setVirtualHost(amqpProperties.getCustomVhost());
}