【问题标题】:Stomp broker with Redis as full featured message broker使用 Redis 作为全功能消息代理的 Stomp 代理
【发布时间】: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


【解决方案1】:

您需要兼容 STOMP 的消息代理。例如RabbitMQ with stomp pluginSpring 直接将每个 STOMP 命令传递给代理。无法将STOMP command 转换为Redis Pub/Sub 命令。

【讨论】:

  • 不完全正确...作为一个简单的文本协议,任何 stomp 命令都可以作为 redis 消息发送
猜你喜欢
  • 1970-01-01
  • 2022-12-14
  • 2020-12-17
  • 2016-04-05
  • 2021-11-07
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2018-11-23
相关资源
最近更新 更多