This PoC project contains a Vert.x Hibernate Reactive setup.
It consists of the following components:
Module | Description |
---|---|
bom | Bill Of Materials POM which tracks all dependency versions. |
api | API Module which contains interfaces for the DAO implementation. |
io-uring | Vert.x Patches which will enable io uring support in Netty. |
flyway | Flyway database migration helper. |
hibernate | Hibernate module which contains the reactive DAO implementations |
rest | Vert.x REST API implementation |
server | Vert.x Http Server runner which provides the REST API |
- Maven 3.6.3
- JDK 16
- Docker Runtime
- Linux Environment (otherwise io uring can be used)
- Vert.x - 4.2.1
- Dagger - 2.39.1
- Hibernate Reactive - 1.1.0.Final
- RxJava - 3.1.3
- Netty - 4.1.69.Final
- Netty io uring - 0.0.10.Final
export JAVA_HOME=<YOUR JDK 16>
mvn clean package -DskipTests
POST /users
- Adds a new user to the databaseGET /users
- Returns UUIDs of all users that have been createdGET /users/:uuid
- Return a specific userDELETE /users/:uuid
- Delete a specific user
The server project contains the io.metaloom.poc.Runner
class which can be used to start the demo server.
Alternatively the server can be started after building via:
java -jar server/target/poc-vertx-hibernate-server-0.0.1-SNAPSHOT.jar
- The
Runner
class prepares the Dagger 2 dependency graph which is needed for dependency injection. - The
io.metaloom.poc.dagger.module
dagger modules prepare various components for DI that are outside of the project (e.g. Vert.xVertxModule
, HibernateHibernateModule
, TestContainerContainerModule
) - The
Bootstrap
class will be used to setup the individual components in the right order (e.g. container->flyway->hibernate->server) - The
RESTServerImpl
class deploys theServerVerticle
verticles which will be provided by dagger. - The
ServerVerticle
verticles startup aHttpServer
and register the Vert.x routes for the REST API. - The handlers for the routes are located within the
GroupCrudHandler
andUserCrudHandler
classes. The handler code utilizes RxJava3 and the Hibernate DAO implementation to interact with the database.
The server requires a postgres database. By default this database will be provides using TestContainers
during startup of the demo application.
- API Testing
- Open API handling
- Authentication?
- Metrics?
-
Download GraalVM
-
Run
gu install native-image
in the extracted JDK to installnative-image
support. -
Build the image
export JAVA_HOME=/opt/jvm/graalvm
mvn clean package -DskipTests -Pnative-image