Kotlin coroutines with Hibernate Reactive¶
The rest-kotlin-co module implements the posts API with Kotlin coroutine
resource methods, Hibernate Reactive, and Panache. Use it to see suspending
functions call reactive repository operations.
Sample structure¶
The POM includes Kotlin support, Quarkus REST, Hibernate Reactive, the
reactive PostgreSQL client, and Hibernate Reactive Panache for Kotlin.
PostResources
declares suspending HTTP methods and calls repository operations with
awaitSuspending. The repository uses Hibernate Reactive Panache.
Check application.properties for PostgreSQL connection configuration and
use a disposable database for this sample.
Run the sample¶
From the rest-kotlin-co directory, run:
./mvnw quarkus:dev
On Windows, run mvnw.cmd quarkus:dev. Run ./mvnw test to execute the tests.
What's next¶
- Compare Kotlin client coroutines in MicroProfile REST Client with Kotlin coroutines.
- See MongoDB Panache with Kotlin coroutines.