3

Is there a way to connect redis as a full featured stompbroker?

As per redis documentation, we can use redis as message broker. we are planning to use redis as a message broker for our chat product. I am trying to connect to redis but its failing. Is there a way to connect reids message broker for stomp?

@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");
  }
}

I got this exception, when I tried. io.netty.handler.codec.DecoderException: java.lang.IllegalArgumentException: No enum constant org.springframework.messaging.simp.stomp.StompCommand.-ERR unknown command CONNECT, with args beginning with:

1 Answers1

0

You need STOMP compatible message broker. For example RabbitMQ with stomp plugin Spring directly pass every STOMP command to broker. There is no way to convert STOMP command to Redis Pub/Sub command.

hurelhuyag
  • 1,691
  • 1
  • 15
  • 20
  • 2
    Not fully true...being a simple text protocol any stomp command can be sent as a redis message – Phate Jul 28 '20 at 16:36