diff --git a/src/main/java/works/weave/socks/shipping/configuration/RabbitMqConfiguration.java b/src/main/java/works/weave/socks/shipping/configuration/RabbitMqConfiguration.java index 1fd1156..921ba3b 100644 --- a/src/main/java/works/weave/socks/shipping/configuration/RabbitMqConfiguration.java +++ b/src/main/java/works/weave/socks/shipping/configuration/RabbitMqConfiguration.java @@ -7,16 +7,22 @@ import org.springframework.amqp.rabbit.core.RabbitTemplate; import org.springframework.amqp.support.converter.Jackson2JsonMessageConverter; import org.springframework.amqp.support.converter.MessageConverter; +import org.springframework.beans.factory.annotation.Value; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; + @Configuration public class RabbitMqConfiguration { + final static String queueName = "shipping-task"; + @Value("${spring.rabbitmq.host}") + private String host; + @Bean public ConnectionFactory connectionFactory() { - CachingConnectionFactory connectionFactory = new CachingConnectionFactory("rabbitmq"); + CachingConnectionFactory connectionFactory = new CachingConnectionFactory(host); connectionFactory.setCloseTimeout(5000); connectionFactory.setConnectionTimeout(5000); connectionFactory.setUsername("guest"); diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties index bda9f69..fc33208 100644 --- a/src/main/resources/application.properties +++ b/src/main/resources/application.properties @@ -1,4 +1,5 @@ server.port=${port:8080} +spring.rabbitmq.host=rabbitmq endpoints.health.enabled=false spring.zipkin.baseUrl=http://${zipkin:zipkin}:9411/ spring.sleuth.sampler.percentage=1.0