java - Spring websocket - sendToUser from a cluster does not work from backup server -


we have spring mvc spring websocket configured ('spring-websocket', version:'4.1.0.release').

we have simple class executes following code:

 @autowired private simpmessagingtemplate template;   @override public void push(long userid, object message, websocketqueue queue) {     string loginname = this.userrepository.getloginname(userid);     this.template.convertandsendtouser(                    loginname,                    queue.getmapping(),                    message);  } 

this works great single tomcat (non clustered environment)

the problem facing when working cluster of 2 tomcats.

if try push message user actual tomcat logged in - works.

but if try push message other tomcat node - not reach user.

1) can do?

2) changing websocket queue names user login names instead of default behavior can us?

this can solved a feature added in spring framework 4.2:

resolve user destinations across cluster of servers

user registries can broadcast , share content using specific topic destination. can set configuring stompbrokerrelay cluster deployment; see setuserdestinationbroadcast , setuserregistrybroadcast.

don't hesitate send feedback / improvement requests on https://jira.spring.io !


Comments

Popular posts from this blog

html - Outlook 2010 Anchor (url/address/link) -

javascript - Why does running this loop 9 times take 100x longer than running it 8 times? -

Getting gateway time-out Rails app with Nginx + Puma running on Digital Ocean -