Spring webflux session management

早过忘川 提交于 2019-12-11 14:53:08

问题


I am using Spring boot 2 with spring webflux running on netty.

I would like to add session management without needing to have a backing database or redis server (so Spring Session doesn't seem to be a solution here).

I could use WebSession in my controllers, but then I would need to enable sticky sessions on my load balancer, which I would prefer to avoid.

What I would like is one of the following:

  • Client side session like in Play framework (session is stored as a cookie and added onto each subsequent request)
  • Hazelcast session replication but this only works with servlet containers

Has anyone experienced the same thing and found a viable solution?


回答1:


Spring Session has plans for providing Hazelcast implementation of ReactiveSessionRepository. The current plan is to wait for Hazelcast 4.0, which will move to Java 8 as baseline and use CompletableFuture instead of their own ICompletableFuture. You can track gh-831 for progress on this topic.

In the meanwhile you could try and use ReactiveMapSessionRepository, passing in Hazelcast's IMap.



来源:https://stackoverflow.com/questions/49839186/spring-webflux-session-management

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!