Vaadin lets you build secure, UX-first PWAs entirely in Java.
Free ebook & tutorial.
Vaadin, spring-boot, microservices and HTTP Sessions
Hi Vaadin experts,
a couple of years ago I discovered Vaadin and I really liked it, a year ago I discovered spring-boot and the microservice approach and I really like it. Now I would like to combine both.
I'm not thinking about a simple Vaadin spring-boot application (I've already created some) but I'm thinking of the spring-boot Netflix stack including spring-boot, Eureka, Hystrix, Ribbon and Zuul.
As far I understood the Neflix stack it is optimized for stateless backend communication: REST webservices in the backend, JS and HTML in the frontend. A request is routed by Zuul to any instance of the microservice, I read somewhere by default this is done in a round robin manner.
This works fine for a JS application but what about Vaadin? As far I know Vaadin needs the HTTP session to hold the application state. Using the Netflix stack - as designed - a request can be routed to any instance with a high chance the session is not available there.
spring-session may solve this by syncing the sessions among all Vaadin instances - but is this some kind of overhead? Is it recommended to implement sticky sessions in Zuul somehow?
How did you implement microservices using Vaadin where you can add / remove instances seamlessly?
Yes, Netflix stack is mostly for stateless services. However it's possible to implement a sticky session rule for a reverse proxy with Zuul. I actually implemented such rule: https://github.com/alejandro-du/vaadin-microservices-demo/blob/master/proxy-server/src/main/java/com/example/StickySessionRule.java
Take a look at the full example: https://github.com/alejandro-du/vaadin-microservices-demo