Skip to content
Leader docs1.0

Bluetape4k Leader manual

Latest stable Based on Leader release 1.0.0

A release-faithful guide to choosing, running, and operating distributed leader election with bluetape4k-leader 1.0.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 1.0.0 at commit e70146330302758f563a46b7286e3ce25f1bac49. Examples are learning projects, not published artifacts. Application builds should normally import io.github.bluetape4k:bluetape4k-dependencies and omit versions from individual leader modules.