Search code examples
redisibm-cloudsession-cache

How can you use Spring Sessions with Redis Service in Bluemix? Is IBM Session Cache an alternative?


The current app (with a competitor) is using Spring-Boot and Spring-Sessions to save session data independent from the instance in Redis.

How can we replicate this in Bluemix?

  1. Is there a way to add on Spring-Sessions to the Redis service?

  2. The other option would be the IBM Session Cache. Does that work with Spring-Boot and Spring-Session? Does the Session Cache service work without Tomcat? (Jetty for example?)


Solution

  • I haven't played with Spring-Sessions yet, but I might be able to point you in the right direction.

    There is a general Redis service available on Bluemix. The open source Java buildpack (Tomcat) promises auto configuration of Redis. I would try this first. To use this buildpack:

    cf push <appname> -b java_buildpack
    

    If that doesn't work, you could read the credentials from VCAP_SERVICES and configure JedisConnectionFactory programmatically connect to it.

    If you use the IBM Session Cache service with a Liberty application on Bluemix, the configuration is auto generated such that standard JEE HTTPSession objects are persisted to the service. It might work with other java runtimes, but configuration would be more manual.

    Hope this helps.