-
Notifications
You must be signed in to change notification settings - Fork 602
Add sample for session resiliency #761
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 21 commits
a96895c
3e09174
fa9b0af
a1af934
5879edd
793cf92
3c6ed2f
d086e09
32391aa
c2308d9
8ab6f9a
9816c4e
7027410
6f9ff3c
2ce5b8d
3eeb4b4
3735bd4
2beca3a
08f647c
1225e4f
8e6a733
fcb425f
42e4e62
a47c70e
86b3349
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| # Resilient web sessions example | ||
|
|
||
| This example is associated with blog post. | ||
|
|
||
| You can go to `docker` folder, create `licensekey.env` with `HZ_LICENSEKEY=<your key here>` and then start cluster using `docker-compose up`. | ||
|
|
||
| After that, you can run `Main` class. | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,32 @@ | ||
| hazelcast: | ||
| cluster-name: london-cluster | ||
| network: | ||
| port: | ||
| port-count: 20 | ||
| auto-increment: true | ||
| port: | ||
| 5701 | ||
| join: | ||
| multicast: | ||
| enabled: false | ||
| tcp-ip: | ||
| enabled: true | ||
| member-list: | ||
| - london-cluster-1 | ||
| wan-replication: | ||
| replicate-to-nyc: | ||
| batch-publisher: | ||
| nycPublisher: | ||
| cluster-name: nyc-cluster | ||
| target-endpoints: "nyc-cluster-1:5701" | ||
| map: | ||
| shopSessions: | ||
| wan-replication-ref: | ||
| replicate-to-nyc: | ||
| merge-policy-class-name: PutIfAbsentMergePolicy | ||
| backup-count: 1 | ||
| # because we are modifying IMap's config not via sessionMapConfigCustomizer, we need to add the index manually | ||
| indexes: | ||
| - type: HASH | ||
| attributes: | ||
| - "principalName" |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,32 @@ | ||
| hazelcast: | ||
| cluster-name: nyc-cluster | ||
| network: | ||
| port: | ||
| port-count: 20 | ||
| auto-increment: true | ||
| port: | ||
| 5701 | ||
| join: | ||
| multicast: | ||
| enabled: false | ||
| tcp-ip: | ||
| enabled: true | ||
| member-list: | ||
| - nyc-cluster-1 | ||
| wan-replication: | ||
| replicate-to-lon: | ||
| batch-publisher: | ||
| lonPublisher: | ||
| cluster-name: london-cluster | ||
| target-endpoints: "london-cluster-1:5701" | ||
| map: | ||
| shopSessions: | ||
| wan-replication-ref: | ||
| replicate-to-lon: | ||
| merge-policy-class-name: PutIfAbsentMergePolicy | ||
| backup-count: 1 | ||
| # because we are modifying IMap's config not via sessionMapConfigCustomizer, we need to add the index manually | ||
| indexes: | ||
| - type: HASH | ||
| attributes: | ||
| - "principalName" |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,33 @@ | ||
| name: resilient-sessions | ||
|
|
||
| services: | ||
| london-cluster: | ||
| image: hazelcast/hazelcast-enterprise:latest | ||
| hostname: london-cluster-1 | ||
| ports: | ||
| - "5701:5701" | ||
| volumes: | ||
| - ./conf-lon:/opt/hazelcast/config | ||
| env_file: | ||
| - licensekey.env | ||
| environment: | ||
| - HAZELCAST_CONFIG=/opt/hazelcast/config/config.yml | ||
|
|
||
| nyc-cluster: | ||
| image: hazelcast/hazelcast-enterprise:latest | ||
| hostname: nyc-cluster-1 | ||
| ports: | ||
| - "5702:5701" | ||
| volumes: | ||
| - ./conf-newyork:/opt/hazelcast/config | ||
| env_file: | ||
| - licensekey.env | ||
| environment: | ||
| - HAZELCAST_CONFIG=/opt/hazelcast/config/config.yml | ||
|
|
||
| management-center: | ||
| image: hazelcast/management-center:latest | ||
| ports: | ||
| - "8180:8080" | ||
| env_file: | ||
| - licensekey.env |
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I haven't checked - but are any of these dependencies overlapping? E.G. does spring boot bring in spring-core?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Spring Security does not, Spring Boot does bring Spring Web, but I wanted to pin to newer version. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,97 @@ | ||
| <?xml version="1.0" encoding="UTF-8"?> | ||
| <project xmlns="http://maven.apache.org/POM/4.0.0" | ||
| xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
| xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
| <modelVersion>4.0.0</modelVersion> | ||
|
|
||
| <artifactId>resilient-sessions-blog</artifactId> | ||
| <parent> | ||
| <groupId>com.hazelcast.samples</groupId> | ||
| <artifactId>spring</artifactId> | ||
| <version>0.1-SNAPSHOT</version> | ||
| </parent> | ||
|
|
||
| <properties> | ||
| <spring.version>7.0.2</spring.version> | ||
| <spring-boot.version>4.0.0</spring-boot.version> | ||
|
|
||
| <!-- needed for checkstyle/findbugs --> | ||
| <main.basedir>${project.parent.parent.basedir}</main.basedir> | ||
| </properties> | ||
|
|
||
| <repositories> | ||
| <repository> | ||
| <id>Hazelcast Private Snapshot Repository</id> | ||
| <url>https://repository.hazelcast.com/snapshot/</url> | ||
| <releases> | ||
| <enabled>false</enabled> | ||
| </releases> | ||
| </repository> | ||
| <repository> | ||
| <id>Hazelcast Private Release Repository</id> | ||
| <url>https://repository.hazelcast.com/release/</url> | ||
| <snapshots> | ||
| <enabled>false</enabled> | ||
| </snapshots> | ||
| </repository> | ||
| </repositories> | ||
|
JackPGreen marked this conversation as resolved.
|
||
|
|
||
| <dependencies> | ||
| <!-- TODO update post-release --> | ||
| <dependency> | ||
| <groupId>com.hazelcast.spring</groupId> | ||
| <artifactId>hazelcast-spring-session</artifactId> | ||
| <version>4.0.0-RC1</version> | ||
| <exclusions> | ||
| <exclusion> | ||
| <groupId>com.hazelcast</groupId> | ||
| <artifactId>hazelcast</artifactId> | ||
| </exclusion> | ||
| </exclusions> | ||
| </dependency> | ||
| <dependency> | ||
| <groupId>com.hazelcast</groupId> | ||
| <artifactId>hazelcast-enterprise</artifactId> | ||
| <version>${hazelcast.version}</version> | ||
| </dependency> | ||
| <dependency> | ||
| <groupId>com.hazelcast</groupId> | ||
| <artifactId>hazelcast-spring</artifactId> | ||
| <version>${hazelcast.version}</version> | ||
| </dependency> | ||
|
|
||
| <dependency> | ||
| <groupId>org.springframework.boot</groupId> | ||
| <artifactId>spring-boot-starter-webmvc</artifactId> | ||
| <version>${spring-boot.version}</version> | ||
| </dependency> | ||
| <dependency> | ||
| <groupId>org.springframework.boot</groupId> | ||
| <artifactId>spring-boot-hazelcast</artifactId> | ||
| <version>${spring-boot.version}</version> | ||
| </dependency> | ||
|
|
||
| <dependency> | ||
| <groupId>org.jspecify</groupId> | ||
| <artifactId>jspecify</artifactId> | ||
| <version>1.0.0</version> | ||
| </dependency> | ||
|
|
||
| <dependency> | ||
| <groupId>org.springframework.security</groupId> | ||
| <artifactId>spring-security-web</artifactId> | ||
| <version>${spring.version}</version> | ||
| </dependency> | ||
| <dependency> | ||
| <groupId>org.springframework.security</groupId> | ||
| <artifactId>spring-security-core</artifactId> | ||
| <version>${spring.version}</version> | ||
| </dependency> | ||
| <dependency> | ||
| <groupId>org.springframework.security</groupId> | ||
| <artifactId>spring-security-config</artifactId> | ||
| <version>${spring.version}</version> | ||
| </dependency> | ||
| </dependencies> | ||
|
|
||
| </project> | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What blog post? Can you link to it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not released yet :(