我正在尝试将 RabbitMQ Web STOMP 插件与 Spring 启动一起使用。我已经启动了 RabbitMQ 服务器,并为 http/web-stomp 协议公开了 15674 端口。当我运行 Spring Boot 项目时,出现以下错误
osmssStompBrokerRelayMessageHandler:会话系统中的 TCP 连接失败:传输失败:java.lang.IllegalArgumentException:没有枚举常量 org.springframework.messaging.simp.stomp.StompCommand.HTTP/1.1 400 错误请求
io.netty.handler.codec.DecoderException: java.lang.IllegalArgumentException: 没有枚举常量 org.springframework.messaging.simp.stomp.StompCommand.HTTP/1.1 400 错误请求
下面是我的 pom.xml 依赖项
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-websocket</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.projectreactor</groupId>
<artifactId>reactor-core</artifactId>
<version>3.2.2.RELEASE</version>
</dependency>
<dependency>
<groupId>io.projectreactor.netty</groupId>
<artifactId>reactor-netty</artifactId>
<version>0.8.2.RELEASE</version>
</dependency>
<dependency>
<groupId>io.netty</groupId>
<artifactId>netty-all</artifactId>
<version>4.0.33.Final</version>
</dependency>
</dependencies>
我使用下面的类作为网络套接字配置
import org.springframework.context.annotation.Configuration;
import org.springframework.messaging.simp.config.MessageBrokerRegistry;
import org.springframework.web.socket.config.annotation.EnableWebSocketMessageBroker;
import org.springframework.web.socket.config.annotation.StompEndpointRegistry;
import org.springframework.web.socket.config.annotation.WebSocketMessageBrokerConfigurer;
@Configuration
@EnableWebSocketMessageBroker
public class WebSocketConfiguration implements
WebSocketMessageBrokerConfigurer {
@Override
public void configureMessageBroker(MessageBrokerRegistry registry) {
registry.setApplicationDestinationPrefixes("/app")
.enableStompBrokerRelay("/topic")
.setRelayHost("localhost")
.setRelayPort(15674)
.setClientLogin("guest")
.setClientPasscode("guest");
}
@Override
public void registerStompEndpoints(StompEndpointRegistry registry) {
registry.addEndpoint("/websocket").withSockJS();
}
}
下面是我的 RabbitMQ Web 插件的快照,它显示了暴露的端口
有人能帮忙吗?