How to setup Tomcat Session Replication with Spring Boot embedded tomcat - spring-boot

I haven't been able to find any guide on how to programmatically setup tomcat session replication when using an embedded tomcat with spring boot. It was even a hard time finding out about the "tomcat-catalina-ha" dependency.
I have a working Tomcat session replication example working when setup on a non-embedded tomcat, but converting it over to Java config hasn't been working. I looked into Hazelcast, but a few of the options I need require the enterprise license. I've also been told that storing sessions in a traditional database doesn't scale well.
I'm looking for a guide or example project that implements Tomcat session replication using an embedded tomcat. Barring that, I'd be interested in why there are no guides in the first place?

Related

Is it possible to turn on session replication for embedded tomcat servers in Spring Boot?

It is clear on how to do it when you have a tomcat server, but what if that server is embedded such as when you use bootJAR to build and run a tomcat webapp directly from a .jar file?
You can use spring-session for store sessions in redis or jdbc
Read docs for more information

Can spring boot applications deployed on a tomcat server use a common connection pooling?

When multiple spring boot applications created and deployed to a tomcat server. Is it possible to use a common connection pooling, datasource instead of providing these details in application.properties file. Or does this already taken care within the spring boot implementation
When you deploy multiple application then each application manages it connection pool.
Spring boot boundary is limited to each application context and it does not know what other application deployed and which db they are using.

how to connect with gemfire running on local machine using spring data gemfire with annoatations

I have tried so many demos but I am not able to create region on my local gemfire .
my code is running in embedded mode but I want to run it as client server mode with using annotions how should I do this.
Thanks.
Your problem description is pretty vague.
You should have a look at my pivotal-gemfire-clientserver-examples that compares and contrasts using native GemFire configuration (both cache.xml and then using GemFire's Java API) vs. Spring configuration (again using both Spring XML as well as Spring Java configuration meta-data).
For instance, you can see here that I configured and bootstrapped a GemFire Server using Spring Boot along with a Java configuration class. The GemFire cache client is my test class (along with the client-side Java config), but easily could have been another standalone, Spring Boot application.
Another, interesting tidbit, is that you can connect to the Spring Boot, GemFire Server application using Gfsh once the server is up and running. To connect in gfsh, use...
gfsh>connect --jmx-manager=localhost[1199]
Hope this helps!
-John

Discovering Hazelcast instance in a Spring Boot eco-system

Background:
We have a set of about 15 Spring Boot applications as microservices. They all run as Docker containers, and run as clusters of one or more instances. We also use Spring Cloud Netflix components such as Eureka and discover the running application instances from the client using Feign/Ribbon.
Question:
As part of the POC exercises, we tested with Redis and Hazelcast for caching and Spring Boot configuration storage. Everything works using Spring Boot, Spring Cloud and Redis/Hazelcast Java client libraries. However, when we deploy Hazelcast in a multi-node peer-to-peer cluster, Hazelcast seems to require a "known" IP address/hostname and the accessible port to be available in the Java client's configuration (with or without Spring). Typically, when Hazelcast is deployed in a multi-instance cluster on ephemeral VM instances (for example, EC2), the IP address and the port information is not available. So we thought of two possible solutions:
Find a way to run Hazelcast as a Spring Boot application, and register it with Eureka as a Discovery Client. That way other Spring Boot applications can use Eureka to discover an instance of Hazelcast dynamically
Find a way in Hazelcast so that it can publish it's IP address and port information dynamically to a central Key/Value store
If anyone has played around with Hazelcast to be able to do either/both of the possible solutions, it would be great if you can share more information on that. If there is a third approach that'd work better, I will be eager to know that as well.

Configure Jetty in Spring Boot using usual Jetty XML

Is there a simple way to use (or reuse) external Jetty configuration files to configure an embedded Jetty web container with Spring Boot.
Programmatic configuration to change only the listening port for example is acceptable, but a full configuration including multiple connectors, thread pools, etc. seems to be better suited with usual Jetty files.
Thanks for your help.
Regards.
There's no support in Spring Boot for configuring Jetty via XML. You can use application.properties for simpler cases or programmatic configuration for things that are more complex.
Boot's Tomcat integration is a little bit ahead of its Jetty integration in terms of what you can configure via application.properties. For example, you can configure Tomcat's thread pool. If you'd like to see some improvements to the Jetty integration then please open an issue, or, even better, a pull request.

Resources