I have a service that uses Spring WebSocket, and the client connects to my service through WebSocket. At this point, my service needs to implement cluster deployment because WebSocket sessions cannot be shared. Therefore, I use Rabbitmq for broadcasting, receive message requests, and send them to Rabbitmq. Then, I use
@RabbitListener (bindings=@ QueueBinding (value=@ Queue(), exchange=@ Exchange (value="test. exchange", type=ExchangeTypes. FANOUT))
to implement dynamic queues, Is there a better way to implement a dynamic queue where each node listens to different queues and then traverses its own WebSocket connection to send? Please provide guidance, everyone!!!Thanks.
To achieve a different queue for each node and consume a message to determine whether the WebSocket connection is on the current node. If it is, send the message, and if it is not, discard it.