Search in sources :

Example 6 with CachingConnectionFactory

use of org.springframework.amqp.rabbit.connection.CachingConnectionFactory in project spring-boot by spring-projects.

the class RabbitAutoConfigurationTests method testConnectionFactoryEmptyVirtualHost.

@Test
public void testConnectionFactoryEmptyVirtualHost() {
    load(TestConfiguration.class, "spring.rabbitmq.virtual_host:");
    CachingConnectionFactory connectionFactory = this.context.getBean(CachingConnectionFactory.class);
    assertThat(connectionFactory.getVirtualHost()).isEqualTo("/");
}
Also used : CachingConnectionFactory(org.springframework.amqp.rabbit.connection.CachingConnectionFactory) Test(org.junit.Test)

Example 7 with CachingConnectionFactory

use of org.springframework.amqp.rabbit.connection.CachingConnectionFactory in project av-service by dvoraka.

the class AmqpCommonServerConfig method serverConnectionFactory.

@Bean
public ConnectionFactory serverConnectionFactory() {
    CachingConnectionFactory connectionFactory = new CachingConnectionFactory(host);
    connectionFactory.setUsername(userName);
    connectionFactory.setPassword(userPassword);
    connectionFactory.setVirtualHost(virtualHost);
    return connectionFactory;
}
Also used : CachingConnectionFactory(org.springframework.amqp.rabbit.connection.CachingConnectionFactory) Bean(org.springframework.context.annotation.Bean)

Example 8 with CachingConnectionFactory

use of org.springframework.amqp.rabbit.connection.CachingConnectionFactory in project av-service by dvoraka.

the class AmqpTestReplicationClientConfig method connectionFactory.

@Bean
public ConnectionFactory connectionFactory() {
    CachingConnectionFactory connectionFactory = new CachingConnectionFactory(host);
    connectionFactory.setUsername(userName);
    connectionFactory.setPassword(userPassword);
    connectionFactory.setVirtualHost(virtualHost);
    return connectionFactory;
}
Also used : CachingConnectionFactory(org.springframework.amqp.rabbit.connection.CachingConnectionFactory) Bean(org.springframework.context.annotation.Bean)

Example 9 with CachingConnectionFactory

use of org.springframework.amqp.rabbit.connection.CachingConnectionFactory in project av-service by dvoraka.

the class AmqpFileCommonConfig method connectionFactory.

@Bean
public ConnectionFactory connectionFactory() {
    CachingConnectionFactory connectionFactory = new CachingConnectionFactory(host);
    connectionFactory.setUsername(userName);
    connectionFactory.setPassword(userPassword);
    connectionFactory.setVirtualHost(virtualHost);
    return connectionFactory;
}
Also used : CachingConnectionFactory(org.springframework.amqp.rabbit.connection.CachingConnectionFactory) Bean(org.springframework.context.annotation.Bean)

Example 10 with CachingConnectionFactory

use of org.springframework.amqp.rabbit.connection.CachingConnectionFactory in project spring-boot by spring-projects.

the class RabbitAutoConfigurationTests method testConnectionFactoryPublisherSettings.

@Test
public void testConnectionFactoryPublisherSettings() {
    load(TestConfiguration.class, "spring.rabbitmq.publisher-confirms=true", "spring.rabbitmq.publisher-returns=true");
    CachingConnectionFactory connectionFactory = this.context.getBean(CachingConnectionFactory.class);
    RabbitTemplate rabbitTemplate = this.context.getBean(RabbitTemplate.class);
    DirectFieldAccessor dfa = new DirectFieldAccessor(connectionFactory);
    assertThat(dfa.getPropertyValue("publisherConfirms")).isEqualTo(true);
    assertThat(dfa.getPropertyValue("publisherReturns")).isEqualTo(true);
    assertThat(getMandatory(rabbitTemplate)).isTrue();
}
Also used : RabbitTemplate(org.springframework.amqp.rabbit.core.RabbitTemplate) DirectFieldAccessor(org.springframework.beans.DirectFieldAccessor) CachingConnectionFactory(org.springframework.amqp.rabbit.connection.CachingConnectionFactory) Test(org.junit.Test)

Aggregations

CachingConnectionFactory (org.springframework.amqp.rabbit.connection.CachingConnectionFactory)15 Test (org.junit.Test)9 Bean (org.springframework.context.annotation.Bean)6 DirectFieldAccessor (org.springframework.beans.DirectFieldAccessor)4 RabbitTemplate (org.springframework.amqp.rabbit.core.RabbitTemplate)3 ConnectionFactory (org.springframework.amqp.rabbit.connection.ConnectionFactory)1 RabbitAdmin (org.springframework.amqp.rabbit.core.RabbitAdmin)1 RabbitMessagingTemplate (org.springframework.amqp.rabbit.core.RabbitMessagingTemplate)1