0

I have a single tomcat server with a Spring application with Stomp.

It uses websockets to notify to subscriber clients some events.

enter image description here

I would like to move the server structure to a balanced multi-server, but my question is: what will happend to websocket clients? They will be notified only by their server!

enter image description here

How can I solve this problem? Is there something already developed to solve this scenario?

Tobia
  • 9,165
  • 28
  • 114
  • 219
  • You need to store event from client somewhere. Maybe Kafka? On event occurence each of ws-server would read it and broadcast to appropriate clients. – Conrad Feb 15 '22 at 14:04
  • But is not possibile to let servers listen each other to topic and relay messages? I was wondering if it is so uncommon to face this problem. – Tobia Feb 15 '22 at 17:39
  • It's possible using spring WebSocketStompClient and communicate through web sockets but it's not the best solution. I'd recommend message broker. – Conrad Feb 15 '22 at 20:44
  • How a message broker can solve the problem? Is it not the same problem, the message will be processes by one server and the reply will be sent only to attached clients, am I wrong? – Tobia Feb 16 '22 at 08:09
  • 1
    Each of ws server would be client of message broker. – Conrad Feb 16 '22 at 09:19

0 Answers0