R2D1 / DOCS

Quarkus

Included in R2D1 1.8.0

The optional R2D1 extension adds Quarkus CDI configuration around the same collection API. The tested baseline is Quarkus 3.39.5 and Java 21+. Managed JDBC virtual threads require Java 25+.

Dependency requirements

Required for every Quarkus integration: dev.nexcraft:r2d1-quarkus:1.8.0. It brings core dev.nexcraft:r2d1 transitively, so do not declare core separately. Quarkus resolves r2d1-quarkus-deployment automatically from the extension descriptor.

implementation("dev.nexcraft:r2d1-quarkus:1.8.0")

Quarkus applications use the Quarkus platform/BOM to align framework versions. If your Gradle plugin or application already imports the Quarkus platform, do not add another BOM dependency.

Backend choice: core R2 + D1 uses adapters included through r2d1. Filesystem or JDBC adapters are needed only when those backends are selected.

Filesystem + JDBC + H2 dependencies

Required only for the filesystem + JDBC + H2 configuration shown below: both R2D1 adapter artifacts, the H2 JDBC driver, and Agroal for the Quarkus-managed datasource. Other database or caller-owned datasource setups use their matching driver/pool. The Quarkus platform supplies versions for Quarkus extensions.

implementation("dev.nexcraft:r2d1-filesystem:1.8.0")
implementation("dev.nexcraft:r2d1-jdbc:1.8.0")
implementation("io.quarkus:quarkus-jdbc-h2")
implementation("io.quarkus:quarkus-agroal")

Enable and configure

Integration is disabled by default. Supply an application CDI DocumentCodec; there is no default JSON codec. Inject R2D1 through a constructor and use the common collection API. The filesystem example also needs an application-owned Executor named documents and the selected Quarkus datasource.

quarkus.r2d1.enabled=true
quarkus.r2d1.document.type=filesystem
quarkus.r2d1.index.type=jdbc
quarkus.r2d1.filesystem.root-directory=./documents
quarkus.r2d1.filesystem.executor=documents
quarkus.r2d1.jdbc.datasource=selected
quarkus.datasource.selected.db-kind=h2
quarkus.datasource.selected.jdbc.url=jdbc:h2:mem:documents;DB_CLOSE_DELAY=-1
quarkus.datasource.selected.devservices.enabled=false
quarkus.r2d1.jdbc.max-concurrency=4
quarkus.r2d1.jdbc.max-pending=64

Application beans and resource ownership

Application facade, factory and storage beans can replace the default producers. A custom IndexStore needs its matching CollectionInitializer. Exact CDI names or Quarkus datasource names select caller resources. Clients, executors and datasources supplied by the application remain borrowed; the extension closes resources it creates on shutdown or failed startup.

JDBC uses bounded platform-thread execution by default. Set quarkus.r2d1.jdbc.execution-mode=virtual-thread explicitly on Java 25+. A named caller executor cannot be combined with an explicit execution mode. Collection schema initialization is lazy.

Native image verification

Filesystem/H2 CRUD and indexed queries passed in JVM, packaged JVM and a native process on GraalVM CE 25.0.2 / macOS arm64. Register document types for reflection explicitly. The smoke application includes AWS CRT 0.48.4 for native checksum class signatures. Linux CI execution, live Cloudflare calls and R2/D1 native transports remain unverified; local adapter source hot reload is also unverified.