Skip to content
Leader docs0.4

Bluetape4k Leader manual

Latest stable Based on Leader release 0.4.0

A release-faithful guide to choosing, running, and operating distributed leader election with bluetape4k-leader 0.4.0.

Leader repository and learning map

Leader election is useful when every service instance can see the same work but only one, or a bounded number, should execute it. This manual starts with execution semantics and failure boundaries before it asks you to choose Redis, SQL, MongoDB, or a control-plane lease.

The central contract is deliberate: ordinary contention is not an error. runIfLeader() executes the action when elected and returns null when another contender owns the lease. Use the result APIs when the action itself may return null.

  1. Follow Getting started with a local elector.
  2. Choose single, group, or strategic election.
  3. Match the API to blocking, future, virtual-thread, or coroutine execution.
  4. Select a backend from infrastructure you already operate.
  5. Define the lease lifecycle, then add metrics and runbooks.

Every behavior and source link in this manual targets release 0.4.0 at commit 17ab7f872c1f96318c73d3580729cac20a67e017. Examples are learning projects, not published artifacts. Application builds should normally import io.github.bluetape4k:bluetape4k-dependencies and omit versions from individual leader modules.