Search code examples
springspring-boothazelcastspring-webfluxspring-session

Spring webflux session management


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?


Solution

  • 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.