【发布时间】:2019-12-30 16:30:51
【问题描述】:
有没有办法将 redis 连接为全功能的 stompbroker?
根据 redis 文档,我们可以使用 redis 作为消息代理。我们计划使用 redis 作为我们聊天产品的消息代理。 我正在尝试连接到 redis,但它失败了。有没有办法为 stomp 连接 reids 消息代理?
@Configuration
@EnableWebSocketMessageBroker
public class WebSocketConfig implements WebSocketMessageBrokerConfigurer {
@Override
public void registerStompEndpoints(StompEndpointRegistry registry) {
registry.addEndpoint("/chat");
}
@Override
public void configureMessageBroker(MessageBrokerRegistry registry) {
registry.setApplicationDestinationPrefixes("/app");
// registry.enableSimpleBroker("/topic");
registry.enableStompBrokerRelay("/topic").setRelayHost("localhost").setRelayPort(6379).setClientLogin("guest").setClientPasscode("guest");
}
}
当我尝试时,我得到了这个例外。
io.netty.handler.codec.DecoderException: java.lang.IllegalArgumentException: 没有枚举常量 org.springframework.messaging.simp.stomp.StompCommand.-ERR 未知命令CONNECT,参数以:
【问题讨论】:
-
你发现了吗?
-
没有。使用内存(simpleBroker)
标签: spring-websocket spring-messaging