Exposed Ktor R2DBC Adapter
Latest stable Based on Exposed release 2.0.0
Coroutine-native R2DBC readiness, transaction, and error helpers for the selective Ktor boundary.
Problem
Section titled “Problem”R2DBC consumers should not inherit blocking JDBC APIs or a cache lifecycle they do not use.
When to use it
Section titled “When to use it”Use this adapter when the application owns an Exposed R2dbcDatabase and uses a coroutine-first persistence path.
Coordinates
Section titled “Coordinates”implementation(platform("io.github.bluetape4k:bluetape4k-dependencies:<version>"))implementation("io.github.bluetape4k.exposed:bluetape4k-exposed-ktor-r2dbc")Core concepts
Section titled “Core concepts”exposedKtorR2dbcReadinessProbe executes SELECT 1 in a cancellable suspendTransaction. Query timeout policy follows the caller-owned Exposed R2DBC configuration.
Quick start
Section titled “Quick start”val probe = exposedKtorR2dbcReadinessProbe(r2dbcDatabase)route.bluetape4kExposedHealthRoutes(listOf(probe))API by task
Section titled “API by task”- Use
exposedKtorR2dbcReadinessProbefor readiness. - Use
ApplicationCall.exposedR2dbcTransactionfor coroutine-native transactions. - Compose
bluetape4kExposedR2dbcErrors()inStatusPages.
Recommended patterns
Section titled “Recommended patterns”Keep transaction blocks suspend-native, propagate cancellation, and close the application-owned pool and database resources in one lifecycle owner.
Integrations
Section titled “Integrations”This module depends on core and Exposed R2DBC only. JDBC and cache APIs are intentionally separate.
Configuration
Section titled “Configuration”Component names and route paths follow core validation. R2DBC timeout behavior is inherited from the caller-owned database and driver.
Failure modes
Section titled “Failure modes”R2DBC failures map to a fixed unavailable response. Cancellation is rethrown. A timeout or failed probe reports TIMEOUT or DOWN without driver details.
Operations
Section titled “Operations”Export core readiness and transaction timers with bounded backend and outcome tags. Instrument the pool and driver separately when their metrics are available.
Testing
Section titled “Testing”Run the R2DBC H2 suite and then PostgreSQL/MySQL integration paths. Cover cancellation, driver timeout, and shared-deadline ordering.
Workshops
Section titled “Workshops”No selective R2DBC workshop is published in this 2.0.0 release line.
Limitations
Section titled “Limitations”Driver support for query cancellation and timeout is implementation-specific; cooperative coroutine cancellation remains the request contract.