有没有办法将redis连接为功能齐全的stompbroker?
根据redis文档,我们可以将redis用作消息代理。我们计划将redis用作我们聊天产品的消息代理。 我正在尝试连接到Redis,但失败了。有没有一种方法可以将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
,args开头:
答案 0 :(得分:0)
您需要兼容STOMP的消息代理。例如RabbitMQ with stomp plugin Spring直接将每个STOMP命令传递给代理。无法将STOMP command转换为Redis Pub/Sub命令。