The library provides closed in pods kubernetes cluster for one service with Spring Cache implementation of Hazelcast JCache.
<dependency>
<groupId>io.github.sevenparadigms</groupId>
<artifactId>kubernetes-embedded-hazelcast</artifactId>
<version>1.2.8</version>
</dependency>
Properties in application.yml:
hazelcast:
port: 5702
kubernetes: false
timeoutMinutes: 30
maxSize: 1000
namespace: default
serviceName:
Service name can also get from: spring.application.name
if property serviceName
is empty. At each property show default value and do not require if expected.
Each cache by name can have own properties:
spring.cache:
<cache name>.expireAfterAccess: 500 # milliseconds
<cache name>.expireAfterWrite: 1000 # milliseconds
<cache name>.maximumSize: 10000
Cache using the fast max policy resolving and at put a many entities in one time - the max policy resolver only for each 250 ms.
Kubernetes yaml:
apiVersion: apps/v1
kind: Deployment
metadata:
name: employee-service
labels:
app: employee-service
spec:
replicas: 2
selector:
matchLabels:
app: employee-service
template:
metadata:
labels:
app: employee-service
spec:
containers:
- name: employee-service
image: piomin/employee-service
ports:
- name: http
containerPort: 8080
- name: multicast
containerPort: 5701
---
apiVersion: v1
kind: Service
metadata:
name: employee-service
labels:
app: employee-service
spec:
ports:
- port: 8080
protocol: TCP
selector:
app: employee-service
type: NodePort