Skip to content
This repository has been archived by the owner on Dec 5, 2023. It is now read-only.

Commit

Permalink
Merge pull request #18 from microservices-demo/rabbitmq-host-optional
Browse files Browse the repository at this point in the history
Make the rabbitmq host configurable
  • Loading branch information
nustiueudinastea committed Feb 14, 2017
2 parents f0b9803 + 8fa69f0 commit 3dbc92a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down
1 change: 1 addition & 0 deletions src/main/resources/application.properties
Original file line number Diff line number Diff line change
@@ -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
Expand Down

0 comments on commit 3dbc92a

Please sign in to comment.