将 SpringSession 与 Google Cloud Datastore 一起用于会话集群

Using SpringSession with Google Cloud Datastore for Session Clustering

我一直在进行研究,试图找到一种使用 SpringSession 来使用 Google Cloud Datastore 对我们的云应用程序进行会话集群的方法。我在寻找此示例实现时遇到了一些麻烦。

我注意到SpringSession示例只提供了redis、hazelcast和jdbc的示例。我想知道是否有人可以帮助我指明使用 SpringSession 通过 GCP 设置会话集群的正确方向?

Spring 会话本身不提供 Google Cloud Datastore 支持的 SessionRepository 实现。据我所知,也没有第 3 方扩展提供 Google Cloud Datastore 支持的实现。

但是,实现由所需数据存储支持的 SessionRepository(或 FindByIndexNameSessionRepository)应该是一项相当简单的任务,重用现有的 Spring 会话基础结构应该非常容易。这是此类配置的片段:

@EnableSpringHttpSession
public class SpringHttpSessionConfig {

    @Bean
    public MySessionRepository sessionRepository() {
        // instantiate and configure MySessionRepository
    }

}

实施SessionRepository时,看看section of Spring Session's reference manual dedicated to that topic