简体   繁体   English

Spring 4 websocket + stomp + rabbitmq和clustering

[英]Spring 4 websocket + stomp + rabbitmq and clustering

I am going through Spring 4 websocket + stomp + rabbitmq(RabbitMQ-Web-Stomp plugin) architecture and I have a question about clustering. 我正在浏览Spring 4 websocket + stomp + rabbitmq(RabbitMQ-Web-Stomp插件)架构,我对集群有一个疑问。 As per my understanding here Spring MVC act as a gateway for STOMP requests. 根据我的理解,Spring MVC充当STOMP请求的网关。 If we cluster the application instance with spring web socket configuration will it create any confusion? 如果我们使用spring web socket配置集群应用程序实例会产生任何混淆吗? For an example will it open multiple listeners and how will in such a case this architecture behave? 举个例子,它会打开多个监听器,在这种情况下这个架构会如何表现?

In this scenario, you would need to use load balancing and a message broker. 在这种情况下,您需要使用负载平衡和消息代理。 I used HAProxy to load balance 4 Spring MVC instances (websocket) running on 4 tomcat servers. 我使用HAProxy来负载平衡在4个tomcat服务器上运行的4个Spring MVC实例(websocket)。 Also configure rabbit mq as a broker. 还将rabbit mq配置为代理。 From client code connect to the single HAProxy url. 从客户端代码连接到单个HAProxy网址。

If you don't use the message broker, then the websocket client subscriptions will be maintained in the app/ web server's (tomcat) JVM and in case one instance goes down, all the subscriptions on that would be lost. 如果您不使用消息代理,那么websocket客户端订阅将在app / web服务器(tomcat)JVM中维护,如果一个实例出现故障,那么所有订阅都将丢失。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM