I'm developing a chat module for a web plateform using the websocket protocol, and STOMP as a message protocol.

It's my first time using any message broker, and Kafka is the one used on the company's (the one i'm working for) web plateform, for other modules I guess. And having previously worked with RabbitMQ when I was just starting, now I have to switch to Kafka. I saw on RabbitMQ's website there's a whole article about how to use STOMP, but there is no such thing on Kafka's official website.

But I've explored several other sources, many tutorials and I couldn't find anything relevant about using STOMP protocol with Kafka, which leads me to ask if it's possible ?

Here's my websocket configuration class :

@Configuration
@EnableWebSocketMessageBroker
public class WebSocketConfig implements WebSocketMessageBrokerConfigurer{

    @Override
    public void registerStompEndpoints(StompEndpointRegistry registry) {
        registry.addEndpoint("/ws").withSockJS();
    }

    @Override
    public void configureMessageBroker(MessageBrokerRegistry registry) {
        registry.setApplicationDestinationPrefixes("/app");
        registry.enableSimpleBroker("/topic");

//Here's the line I wrote to use Kafka as a MB, but doesn't work        
registry.enableStompBrokerRelay("/topic").setRelayHost("localhost").setRelayPort(9092);

After lauching Kafka, and then running my Java Spring app, I get a "connection reset by peer" from a java.io.IOException, which is not supposed to be thrown if everything works fine.

I'm using Kakfa's 2.2.0 release, Zookeeper's 3.4.14 release, and using STS 3 as my IDE.

Any help would be appreciated.

1 Answers

1
Gary Russell On

RabbitMQ doesn't natively support STOMP, but it has a STOMP plugin; Kafka has no built-in support for STOMP.