Bounded slot admission
Every active slot has its own token and TTL.
Latest slot events
| Tick | Candidate | Operation | Token | TTL | Outcome |
|---|
Visual companion · Release 0.4.0 · Redis Lettuce
LeaderGroupElector keeps the token-and-lease model and changes one boundary: up to maxLeaders candidates may own independent slots.
Every active slot has its own token and TTL.
| Tick | Candidate | Operation | Token | TTL | Outcome |
|---|
Step 01 · Delta model
The detailed LeaderElector companion explains acquire, token, TTL, expiry, and release. Here each admitted candidate receives an independent slot token.
All candidates use the same lockName.
At most maxLeaders tokens remain active.
A full group can produce LeaderRunResult.Skipped.
A token is ownership evidence, not a stable shard number.
Step 02 · Settings
Maximum concurrent slot owners. Direct options accept values greater than or equal to 1.
Use more candidates than slots to make saturation visible.
Keep their single-leader meanings for each slot attempt and TTL.
Keeps a successful slot for a minimum duration after fast completion.
Explicit active-lock extension exists as an advanced contract, but this delta companion does not animate it.
Step 03 · Direct API
val group = connection.leaderGroupElection(
LeaderGroupElectionOptions(
maxLeaders = 3,
waitTime = 500.milliseconds,
leaseTime = 10.seconds,
)
)
val value = group.runIfLeader("thumbnail-workers") {
processNextClaimedBatch()
}
val state: LeaderGroupState =
group.state("thumbnail-workers")
processNextClaimedBatch() still needs a queue or claim table. Slot admission alone does not assign unique work.
Step 04 · Spring Boot
@LeaderGroupElection(
name = "thumbnail-workers",
maxLeaders = 3,
waitTime = "PT0.5S",
leaseTime = "PT10S",
)
fun processNextClaimedBatch(): BatchSummary? =
service.processNextClaimedBatch()
While direct LeaderGroupElectionOptions accepts maxLeaders >= 1, Spring startup validation requires @LeaderGroupElection.maxLeaders > 1 and directs a single leader to @LeaderElection.
Synchronous, suspend, and Mono are supported. Flux and Kotlin Flow are rejected because per-slot stream lease extension is undefined.
Step 05 · Failure and recovery
Run saturation to see a contender skip. Run expiry to see one token disappear and a later candidate enter the newly available capacity with a new token.
Do not turn a rendered slot position into a business partition. Use application-owned work distribution.
Release evidence