Spring Boot
DSM ships a supported Spring Boot path centered on DsmRuntime.
Add The Starter
xml
<dependency>
<groupId>com.leanowtech.dsm</groupId>
<artifactId>dsm-spring-boot-starter</artifactId>
<version>${dsm.version}</version>
</dependency>Provide Codec And Factory Beans
- Register collections need
DsmEntityCodec<E>beans. - Lease collections also need an entity factory bean.
- CRDT collections need an update codec, state codec, initial state bean, and merger bean.
Configure application.yml
dsm.cluster-id and dsm.service-id are both required.
yaml
dsm:
cluster-id: runtime-example
service-id: runtime-example
cluster:
mode: standalone
collections:
- bean-name: routeHintsCollection
tenant-id: shared
application-id: gateway
collection-id: route-hints
schema-id: route-hints/v1
type: REGISTER
codec-bean: routeHintCodec
- bean-name: shardOwnerCollection
tenant-id: shared
application-id: worker
collection-id: shard-owner
schema-id: shard-owner/v1
type: LEASE
codec-bean: shardOwnerCodec
lease:
entity-factory-bean: shardOwnerEntityFactoryCluster Modes
| Mode | Property | Best fit |
|---|---|---|
| Standalone | dsm.cluster.mode=standalone | local development and demos |
| Multicast | dsm.cluster.mode=multicast | trusted LAN or VPC networks |
| Unicast | dsm.cluster.mode=unicast | Kubernetes and cloud deployments |
Unicast settings live under dsm.cluster.unicast.*.
Security
yaml
dsm:
security:
enabled: true
cluster-secret: ${DSM_CLUSTER_SECRET}
nonce:
window-size: 1024
max-clock-drift: 5sWhat The Starter Creates
When you use the starter, Spring auto-configures:
NodeInfoClusterMembershipDsmRuntimeDsmCollectionRegistryDsmRuntimeLifecycleDsmRuntimeRegistrationReporterDsmMetrics
Collection handles are also exposed as beans using either bean-name or the default dsmCollection:<tenant>/<application>/<collection> naming scheme.