Skip to content
Leader docs0.4

Redis Redisson backend

Latest stable Based on Leader release 0.4.0

Library module

Implements single, group, and strategic election with Redisson locks/semaphores and blocking/coroutine APIs.

Choose it when Redisson is already the Redis client and its distributed-object API is preferred over direct Lettuce scripting.

Artifact: io.github.bluetape4k.leader:bluetape4k-leader-redis-redisson

dependencies {
implementation(platform("io.github.bluetape4k:bluetape4k-dependencies:<version>"))
implementation("io.github.bluetape4k.leader:bluetape4k-leader-redis-redisson")
}

Acquisition always passes explicit leaseTime, so Redisson’s native watchdog is disabled. Core LeaderLeaseAutoExtender is the only automatic extender when enabled.

val elector = RedissonLeaderElector(redissonClient)
elector.runIfLeader("webhook-poller") { pollWebhooks() }

Use blocking/suspend single/group and strategic electors plus factories. Group election maps to semaphore-style permits.

Keep one caller-owned client, stable lock names, explicit lease sizing, idempotent actions, and a deliberate choice about shared autoExtend.

Spring factories use RedissonClient. redisson-watchdog explains the distinction between native watchdog and the library’s shared extender.

Configure wait/lease/minimum lease, auto-extension, group size, Redis topology, client timeout, retry, and codec independently.

Contention returns null. Interrupts, Redis/client failures, lost ownership, and extend/release errors propagate according to the backend classifier.

Monitor Redis latency, connection state, lock TTL, permit usage, extension failures, skip rate, and failover events. Do not assume the native watchdog renewed a lock.

Test two clients, explicit lease expiry, shared extender, owner-safe release, group permits, strategic registry, failover, and suspend cancellation.

Run redisson-watchdog before production adoption, then compare rate-limiter and strategic-election examples.

Explicit leases can expire during long pauses. Redisson ownership still does not fence writes to another store.

These diagrams are loaded directly from README assets published with the 0.4.0 release and pinned to its immutable commit. They describe this manual’s released structure and runtime flows, not later Snapshot changes. Select a preview to open the SVG at the same release commit.

leader redis redisson Class Structure diagram

Section titled “leader redis redisson Class Structure diagram”

leader redis redisson Class Structure diagram

Release README: leader-redis-redisson/README.md

Scenario 1 — Normal acquire/release plus crash recovery diagram

Section titled “Scenario 1 — Normal acquire/release plus crash recovery diagram”

Scenario 1 — Normal acquire/release plus crash recovery diagram

Release README: leader-redis-redisson/README.md

Scenario 2 — minLeaseTime via updateLeaseTime diagram

Section titled “Scenario 2 — minLeaseTime via updateLeaseTime diagram”

Scenario 2 — minLeaseTime via updateLeaseTime diagram

Release README: leader-redis-redisson/README.md

Elector · Shared extender delegate · Stable guide