Aravind R
Aravind R

Reputation: 766

Hazelcast Session Replciation With Spring Boot

Am following this documentation for Hazelcast based session replication in a Spring Boot APP.

http://docs.spring.io/spring-session/docs/current/reference/html5/guides/hazelcast-spring.html

The code works fine when a local Hazelcast node gets created from spring boot however what i need is a Hazelcast client code to connect to standalone cluster and do the replication and return back the Session ID as a header in "x-auth-header " field.

Client code is something like this

   ClientConfig clientConfig = new ClientConfig();
    clientConfig.getGroupConfig().setName("dev").setPassword("dev-pass");
    clientConfig.getNetworkConfig().addAddress("x.x.x.x");

I am able to get it working with a WEB Filter but it stores the value as cookie and what i need is the header strategy to work.

I couldn't find any documenation or help to acheive it using a Hazelcast client. Can some one please guide me on how to do it.

Thanks Aravind

Upvotes: 0

Views: 739

Answers (3)

Aravind R
Aravind R

Reputation: 766

The issue was related to the server nodes and firewall in between. Migrated to a separate set of nodes and everything started working.

Upvotes: 0

Aravind R
Aravind R

Reputation: 766

Thanks for the quick reply . It works when I create a springawarewebfilter and then define the cookie params. In that case when I add the header strategy it doesn't work and still resolves to cookies.

May be it was misleading but it worked with springawarewebfilter which I think is different as the above specified link creates a different filter for handling session

Upvotes: 0

Neil Stevenson
Neil Stevenson

Reputation: 3150

Do you have

@Bean
public HeaderHttpSessionStrategy sessionStrategy() {
  return new HeaderHttpSessionStrategy();
}

If everything else is working, this should be all you need

Upvotes: 2

Related Questions