Spring启动和RabbitMQ:无法连接到reactor.io.net.impl.netty.tcp.NettyTcpClient

时间:2017-04-11 07:51:52

标签: java spring websocket rabbitmq broker

我按如下方式设置了我的春季启动应用程序:

application.properties

spring.rabbitmq.host=127.0.0.1
spring.rabbitmq.port=5672
spring.rabbitmq.username=guest
spring.rabbitmq.password=guest

WebSocketConfig.java

@Configuration
@EnableWebSocketMessageBroker
public class WebSocketConfig extends AbstractWebSocketMessageBrokerConfigurer {

    @Override
    public void configureMessageBroker(MessageBrokerRegistry registry) {

        registry.enableStompBrokerRelay("/topic","/queue/");
        registry.setApplicationDestinationPrefixes("/app");


    }
}

RabbiMQ配置 :(安装在Windows 7上)

Protocol    Bound to    Port
amqp        127.0.0.1   5672
clustering  ::          25672
http        0.0.0.0     15672
http        ::          15672

当我启动应用程序时,我发现了这个错误:

Failed to connect to reactor.io.net.impl.netty.tcp.NettyTcpClient

即使我在配置类中设置了属性,也会发生这种情况。

有什么想法吗?

由于

1 个答案:

答案 0 :(得分:3)

您需要使用以下命令在RabbitMQ上启用stomp代理:

rabbitmq-plugins enable rabbitmq_stomp

此外,STOMP的端口是61613,而不是5672。