0
votes

I am trying to run spring dataflow local server and configure rabbitmq binder for all applications. I have rabbitmq running on docker on host 172.17.0.2.

java -jar spring-cloud-dataflow-server-local-1.2.3.RELEASE.jar 
--spring.cloud.dataflow.applicationProperties.stream.spring.cloud.stream.binders.rabbit1.type=rabbit 
--spring.cloud.dataflow.applicationProperties.stream.spring.cloud.stream.binders.rabbit1.environment.spring.rabbit.host=172.17.0.2 
--spring.cloud.dataflow.applicationProperties.stream.spring.cloud.stream.binders.rabbit1.environment.spring.rabbit.user=guest 
--spring.cloud.dataflow.applicationProperties.stream.spring.cloud.stream.binders.rabbit1.environment.spring.rabbit.password=guest

Exception

{
"timestamp": 1502479027168,
"status": 500,
"error": "Internal Server Error",
"exception": "org.springframework.messaging.MessageHandlingException",
"message": "error occurred in message handler [org.springframework.integration.amqp.outbound.AmqpOutboundEndpoint@45e29e0]; nested exception is org.springframework.amqp.AmqpConnectException: java.net.ConnectException: Connection refused (Connection refused)",
"path": "/"
}

Spring Data Flow can't find RabbitMQ.

2

2 Answers

0
votes

I wonder if there is a typo in your properties. Instead of applicationProperties.stream.spring.cloud.stream.binders.rabbit1.environment.spring.rabbit.host=172.17.0.2, it should be applicationProperties.stream.spring.cloud.stream.binders.rabbit1.environment.spring.rabbitmq.host=172.17.0.2.

It needs to be spring.rabbitmq.host. Same is true for the other two properties.

0
votes

There's one more aspect to the problem.

By default, the RabbitMQ is accessible to the local machine only. If you want to access it from some other machine, you generally create one entry in "rabbitmq.config" file. Location of this file varies from OS to OS.

  1. In Linux, you can find this at: "/etc/rabbitmq/rabbitmq.config"
  2. In Windows machine, you can find it at: "C:\Program Files\RabbitMQ Server\rabbitmq_server-3.6.9\etc\rabbitmq.config".

There's a possibility that you don't find this file at the mentioned location. This is an optional file and you need not to worry if it is missing even. You can create your own. This entry is something like:

[{rabbit, [{tcp_listeners, [{"<IP_OF_MACHINE>", 5672}]},{loopback_users, []}]}].

With this, you can access the server from any remote machine.

If after this you get the server inaccessible you can modify the entry to:

[{rabbit, [{tcp_listeners, [{"0.0.0.0", 5672}]},{loopback_users, []}]}].

You will definitely get the server connected to any client as well as through management console (if plugin enabled)