Class InMemoryRedisAdapterServerApplication

java.lang.Object
am.ik.redis.adapter.boot.inmemory.InMemoryRedisAdapterServerApplication

@SpringBootApplication public class InMemoryRedisAdapterServerApplication extends Object
Entry point of the adapter server that keeps its sessions in this process's own memory.

Run it as it is and it listens on 6379, which is all an application needs to have its sessions served:

java -jar redis-adapter-for-spring-session-server-inmemory-<version>-exec.jar
Everything is configured through RedisAdapterProperties and InMemoryBackendProperties, so the usual Spring Boot sources apply — a command line argument, an application.properties beside the jar, or the environment variables a container platform hands over:
REDIS_ADAPTER_PORT=16379
REDIS_ADAPTER_PASSWORD=s3cret
REDIS_ADAPTER_DATABASES=16

The application also serves /actuator/health and the metrics of whatever registry is on its classpath over HTTP, on the usual Spring Boot port — that port carries nothing but the actuator.

Running more than one

The adapter itself keeps no session state: everything it is asked to remember goes to the backend. Several replicas behind a load balancer therefore serve the same sessions, but only as far as the backend does — and this one does not, since each replica owns its own map. Scaling horizontally means a server built around a backend that is shared, and one that can tell a replica about a key another replica expired, since that is what an application's session-expired event is made of. redis-adapter-for-spring-session-server-etcd is that server.
  • Constructor Details

    • InMemoryRedisAdapterServerApplication

      public InMemoryRedisAdapterServerApplication()
  • Method Details

    • main

      public static void main(String[] args)