Search code examples
dockerrabbitmqspring-cloudhystrixturbine

spring cloud hystrix turbine amqp connection refused with docker


I have setup a demo application based on Spring Cloud and the Netflix OSS suite of offerings. When I run all the modules, the app runs perfectly in my local development environment as well as out on Pivotal Web Services.

The problem I am running into is when I am configuring the modules to run in docker. When I bring up an app that is dependent on RabbitMQ for Hystrix/Turbine, I am getting AMQP Connection Exceptions.

2015-07-30 15:32:15.567  WARN 1 --- [askExecutor-262] o.s.a.r.l.SimpleMessageListenerContainer : Consumer raised exception, processing can restart if the connection factory supports it. Exception summary: org.springframework.amqp.AmqpConnectException: java.net.ConnectException: Connection refused

I started rabbitmq in docker with the following configuration:

docker run -d --hostname rabbitmq    --name rabbitmq    -p 5672:5672 -p 15672:15672 rabbitmq:3-management

I can access the management port without issue in the browser.

When I fire up one of the dependent projects in docker, I specify rabbitmq with a docker link argument:

--link rabbitmq:rabbitmq

Any idea what is missing here?


Solution

  • I found the solution. I needed to edit my docker profile in my application.yml files to change the rabbitmq hostname.

    spring:
      profiles: docker
      rabbitmq:
        host: rabbitmq