Search code examples
sessionjettyhazelcastembedded-jetty

how to get all sessions in jetty servlet with hazelcast session replication?


my application is based on embedded-jetty with session replication using hazelcast.

In a periodic job We would like to have all sessions currently active to process/send them to another microservice


Solution

  • Sessions are stored in an IMap

    You can set the name for this with the map-name property for the web filter.

    So if this parameter is set the same across all web applications, you'll find all the sessions in the one IMap.

    If it makes sense for your use-case, you could store the sessions for one application in one IMap and for other applications in another IMap. They don't have to be all together, though usually that's easiest.