Spring Session for Apache Geode
2.7.0Spring Session for Apache Geode (SSDG) provides an implementation of the core Spring Session framework using Apache Geode to manage a user’s Session information.
Session state is stored in Apache Geode by leveraging Spring Data for Apache Geode. By integrating with Apache Geode, you have the full power of this technology (Strong Consistency, Low Latency, High Availability, Resiliency, and so on) at your finger tips in your Spring Boot applications.
It is even possible to use SSDG when deploying and running your Spring Boot applications in Pivotal CloudFoundry, using Pivotal Cloud Cache, which is itself based on Apache Geode.
Features
Spring Session for Apache Geode (SSDG) provides the following features:
-
HTTP and WebSocket Session state management using Apache Geode as the backend.
-
Clustered & Distributed Session Management - Improves on the availability and resilience of your system architecture.
-
Strong Consistency - Apache Geode implements strong consistency guarantees, much like a database.
-
Custom Expiration Policies - For example, support for fixed Session timeouts.
-
Custom Data Serialization - Enable the (HTTP) Session state to be serialized other than by Java Serialization so that application classes you put into the Session do not need to implement
java.io.Serializable
. -
Custom Change Detection - You can decide whether the Session is dirty or not and what gets sent (e.g. the delta) between your Spring Boot application and the Apache Geode cluster in a client/server topology.
-
Powerful Pub/Sub mechanics - Allows you to register interests or express interests in Session changes based using a query predicate to receive notifications of updates.
Adding Spring Session for Apache Geode to your build
Spring Session for Apache Geode is part of a Maven BOM (Bill of Materials) used to coordinate versions between the core Spring Session projects and this Apache Geode extension. Each BOM release is called a release train and has a naming strategy, for example: Apple-SR9
, Bean-SR12
, Corn-SR6
, Dragonfruit-SR3
, 2020.0.7
, 2021.0.4
, 2021.1.1
, 2021.2.0-M1
, and 2022.0.0-M1
.
Using the BOM with Maven
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework.session</groupId>
<artifactId>spring-session-bom</artifactId>
<version>2021.1.1</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
Then, you can add the BOM as a dependency to your Spring Boot application Maven POM file:
<dependencies>
<dependency>
<groupId>org.springframework.session</groupId>
<artifactId>spring-session-data-geode</artifactId>
</dependency>
</dependencies>
Using the BOM with Gradle
Since Gradle has no first-class support for Maven BOMs, you may use Spring’s Dependency Management Plugin.
Apply the plugin from Gradle Plugin Portal (update the version if needed):
plugins {
id 'io.spring.dependency-management' version '1.0.11.RELEASE'
}
Then use it to import the BOM:
dependencyManagement {
imports {
mavenBom 'org.springframework.session:spring-session-bom:2021.1.1'
}
}
Finally, add a dependency to the project without a version:
dependencies {
compile 'org.springframework.session:spring-session-data-geode'
}
Spring Boot Config
If you are using Spring Boot, and specifically, Spring Boot for Apache Geode(SBDG), you can include the starter for Spring Session for Apache Geode (SSDG) in your Spring Boot application Maven POM file.
For example:
<dependencies>
<dependency>
<groupId>org.springframework.geode</groupId>
<artifactId>spring-geode-starter-session</artifactId>
<version>1.6.3.RELEASE</version>
</dependency>
</dependencies>
See the SBDG Version Compatibility Matrix for more details.
Quickstart Your Project
Documentation
2.7.0 CURRENT GA | Reference Doc. | API Doc. |
3.0.0-SNAPSHOT SNAPSHOT | Reference Doc. | API Doc. |
3.0.0-M3 PRE | Reference Doc. | API Doc. |
2.7.1-SNAPSHOT SNAPSHOT | Reference Doc. | API Doc. |
2.6.2-SNAPSHOT SNAPSHOT | Reference Doc. | API Doc. |
2.6.1 GA | Reference Doc. | API Doc. |
A few examples to try out:
- Spring Session for Apache Geode & Spring Boot Shows how to use Spring Session for Apache Geode in your Spring Boot applications.
- Spring Session for Apache Geode using Scoped Proxies Shows how Spring Session for Apache Geode works when Scoped Proxies are used in your Spring Boot applications and you have Spring beans with a scope other than 'singleton' (e.g. 'session' or 'request' scoped beans).
- Configuring Spring Session for Apache Geode client/server using JavaConfig Shows how to use Spring Session for Apache Geode in a client/server topology configured with JavaConfig.
- Configuring Spring Session for Apache Geode client/server using XML Shows how to use Spring Session for Apache Geode in a client/server topology configured with XML.
- Configuring Spring Session for Apache Geode P2P using JavaConfig Shows how to use Spring Session for Apache Geode in a P2P topology configured with JavaConfig.
- Configuring Spring Session for Apache Geode P2P using XML Shows how to use Spring Session for Apache Geode in a P2P topology configured with XML.