Соединение Rabbitmq отклонено в потоке потока данных спринта - PullRequest
0 голосов
/ 02 декабря 2018

Я запускаю spring-cloud-dataflow-server-local со следующими параметрами:

java -jar spring-cloud-dataflow-server-local-1.5.1.RELEASE.jar --spring.datasource.url=jdbc:mysql://192.168.0.103:3306/scdf --spring.datasource.username=root --spring.datasource.password=12345 --spring.datasource.driver-class-name=org.mariadb.jdbc.Driver --spring.rabbitmq.host=192.168.0.103 --spring.rabbitmq.port=5672 --spring.rabbitmq.username=admin --spring.rabbitmq.password=admin

Сервер работает, но когда я создаю поток и развертываю поток, он показывает, что соединение отклонено отсервер rabbitmq.Я создал сервер rabbitmq в Docker-контейнере и работает нормально, потому что я проверил его, используя следующий код:

package org.niklas.tutorial;

import com.rabbitmq.client.Channel;
import com.rabbitmq.client.Connection;
import com.rabbitmq.client.ConnectionFactory;

import java.io.IOException;
import java.net.URISyntaxException;
import java.security.KeyManagementException;
import java.security.NoSuchAlgorithmException;

public class Publisher {

    public static void main(String[] args) throws NoSuchAlgorithmException, KeyManagementException, URISyntaxException, IOException, InterruptedException {
        ConnectionFactory factory = new ConnectionFactory();
        factory.setUri("amqp://admin:admin@192.168.0.103");
        factory.setConnectionTimeout(300000);
        Connection connection = factory.newConnection();
        Channel channel = connection.createChannel();

        channel.queueDeclare("my-queue", true, false, false, null);

        int count = 0;

        while (count < 5000) {
            String message = "Message number " + count;

            channel.basicPublish("", "my-queue", null, message.getBytes());
            count++;
            System.out.println("Published message: " + message);

            Thread.sleep(5000);
        }
    }
}

И приведенный выше код работает, как и ожидалось, и из-под контроля управления я могу легко получить доступ к своему rabbitmqсервер.К сожалению, когда я пытаюсь развернуть любой поток, используя spring-cloud-dataflow-server-local, он показывает мне отклоненную ошибку соединения на консоли, которая

start if the connection factory supports it. Exception summary: org.springframework.amqp.AmqpConnectException: java.net.ConnectException: Connection refused (Connection refused)
2018-12-02 11:47:56.250  INFO 1343 --- [N.toll-stream-1] o.s.a.r.l.SimpleMessageListenerContainer : Restarting Consumer@49a71302: tags=[{}], channel=null, acknowledgeMode=AUTO local queue size=0
2018-12-02 11:48:01.322  WARN 1343 --- [N.toll-stream-2] 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 (Connection refused)
2018-12-02 11:48:01.322  INFO 1343 --- [N.toll-stream-2] o.s.a.r.l.SimpleMessageListenerContainer : Restarting Consumer@3f73c8e6: tags=[{}], channel=null, acknowledgeMode=AUTO local queue size=0
2018-12-02 11:48:06.399  WARN 1343 --- [N.toll-stream-3] 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 (Connection refused)
2018-12-02 11:48:06.399  INFO 1343 --- [N.toll-stream-3] o.s.a.r.l.SimpleMessageListenerContainer : Restarting Consumer@59562a94: tags=[{}], channel=null, acknowledgeMode=AUTO local queue size=0
2018-12-02 11:48:11.478  WARN 1343 --- [N.toll-stream-4] 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 (Connection refused)
2018-12-02 11:48:11.479  INFO 1343 --- [N.toll-stream-4] o.s.a.r.l.SimpleMessageListenerContainer : Restarting Consumer@773d1ebe: tags=[{}], channel=null, acknowledgeMode=AUTO local queue size=0
2018-12-02 11:48:16.569  WARN 1343 --- [N.toll-stream-5] 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 (Connection refused)
2018-12-02 11:48:16.569  INFO 1343 --- [N.toll-stream-5] o.s.a.r.l.SimpleMessageListenerContainer : Restarting Consumer@152e6b97: tags=[{}], channel=null, acknowledgeMode=AUTO local queue size=0
2018-12-02 11:48:21.653  WARN 1343 --- [N.toll-stream-6] 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 (Connection refused)
2018-12-02 11:48:21.653  INFO 1343 --- [N.toll-stream-6] o.s.a.r.l.SimpleMessageListenerContainer : Restarting Consumer@7c11dc5a: tags=[{}], channel=null, acknowledgeMode=AUTO local queue size=0
2018-12-02 11:48:26.744  WARN 1343 --- [N.toll-stream-7] 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 (Connection refused)
2018-12-02 11:48:26.744  INFO 1343 --- [N.toll-stream-7] o.s.a.r.l.SimpleMessageListenerContainer : Restarting Consumer@a9dd22f: tags=[{}], channel=null, acknowledgeMode=AUTO local queue size=0
2018-12-02 11:48:31.831  WARN 1343 --- [N.toll-stream-8] 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 (Connection refused)

Нужна помощь.И есть ли возможность узнать, какой IP-адрес сервера rabbitmq используется с консоли spring-cloud-dataflow-server?

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...