Search code examples
springspring-websocketstomp

What's the benefit of using dedicated STOMP broker over the simple in-memory broker in Spring-Websocket?


I'm new to Spring-Websocket and in the documentation and nearly all tutorials it's said that the simple in-memory broker can be used or alternatively a dedicated STOMP broker like RabbitMQ or ActiveMQ.

My main goal is to avoid unnecessary work by adding a dedicated STOMP broker to my project, even though I don't need it.

So, my question is what are the benefits of using a dedicated STOMP broker? When do I need a dedicated STOMP broker?

I don't want to know what the pros and cons of dedicated STOMP brokers are like in this post and I also don't want to know if I need a stomp broker like in this post.


Solution

  • There are many things which enables you to choose between STOMP broker over simple in memory brokers.

    1. Scale-ability - STOMP brokers allows multiple producers and consumers thus allows scale whereas Web Socket In memory brokers are limited to the instance they are running in.
    2. Fault Tolerance - STOMP brokers are persistent and can allow retry where as Web Socket In memory brokers are "In Memory". During a failure the messages are gone for good.
    3. Monitoring - STOMP brokers are easy to monitor, where as Web Socket In memory brokers are not so much.

    So you need to decide the scope of the application you are building to make the decision between STOMP brokers and In memory Web Socket Brokers.