Exposed JDBC backend
Latest stable Based on Leader release 0.4.0
Library module
Problem
Section titled “Problem”Implements single and group election with Exposed JDBC transactions for blocking and virtual-thread services.
When to use it
Section titled “When to use it”Choose it when an operated relational database should also coordinate jobs and an extra coordination service is unjustified.
Coordinates
Section titled “Coordinates”Artifact: io.github.bluetape4k.leader:bluetape4k-leader-exposed-jdbc
dependencies { implementation(platform("io.github.bluetape4k:bluetape4k-dependencies:<version>")) implementation("io.github.bluetape4k.leader:bluetape4k-leader-exposed-jdbc")}Core concepts
Section titled “Core concepts”Conditional row transitions acquire leases; expiry and owner tokens stop an old holder releasing a newer lease.
Quick start
Section titled “Quick start”val elector = ExposedJdbcLeaderElector(database)elector.runIfLeader("invoice-close") { closeInvoices() }API by task
Section titled “API by task”Use blocking, group, factory, extension, history-sink, or ExposedJdbcVirtualThreadLeaderElector APIs by task.
Recommended patterns
Section titled “Recommended patterns”Create schema before traffic, keep acquire transactions short, and separate the protected business transaction unless atomic coupling is deliberate.
Integrations
Section titled “Integrations”Works with the release’s Exposed JDBC databases. Spring can build factories from a Database bean.
Configuration
Section titled “Configuration”Tune wait, lease, minimum lease, retry, schema, isolation, statement timeout, and pool capacity.
Failure modes
Section titled “Failure modes”Contention returns null; connection, permission, schema, rollback, and retry-exhaustion failures propagate.
Operations
Section titled “Operations”Watch database latency, pool saturation, retries, cleanup, indexes, and clock consistency.
Testing
Section titled “Testing”Use the production dialect in Testcontainers and test two connections, expiry, stale-owner release, group capacity, and rollback.
Workshops and learning path
Section titled “Workshops and learning path”Run migration-gate, compare R2DBC, then use batch-scheduler for a Spring job.
Limitations
Section titled “Limitations”The database is on every acquire path. Lease and business action are not one transaction unless explicitly designed that way.
Release diagrams
Section titled “Release diagrams”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 exposed jdbc Class Structure diagram
Section titled “leader exposed jdbc Class Structure diagram”Release README: leader-exposed-jdbc/README.md
