This project uses Quarkus, the Supersonic Subatomic Java Framework.
If you want to learn more about Quarkus, please visit its website: https://quarkus.io/ .
You can run your application in dev mode that enables live coding using:
./mvnw compile quarkus:devYou can then see the indexed entity types there, and trigger mass indexing:
And you can trigger the various endpoints (CRUD, search, ...) through Swagger UI:
http://0.0.0.0:9000/q/swagger-ui/
This will build a container and run it, along with all the necessary services (PostgreSQL, Elasticsearch, ...):
./mvnw clean package
podman compose up
# OR
docker compose upAs in dev mode, you can trigger the various endpoints (CRUD, search, ...) through Swagger UI:
http://0.0.0.0:9000/q/swagger-ui/
You can also easily add additional instances of the application to the "cluster":
podman run --rm -it \
--net hsearch-outbox-polling_pgnet,hsearch-outbox-polling_esnet \
-e QUARKUS_DATASOURCE_JDBC_URL=jdbc:postgresql://pg01:5432/hibernate_demo \
-e QUARKUS_DATASOURCE_USERNAME=hibernate_demo \
-e QUARKUS_DATASOURCE_PASSWORD=hibernate_demo \
-e QUARKUS_HIBERNATE_SEARCH_ORM_ELASTICSEARCH_HOSTS=es01:9200,es02:9200 \
hibernate-demo/hsearch-outbox-polling:1.0.0-SNAPSHOTAfter adding an instance, watch the logs of each application for hints of rebalancing, and see when you how listener and observe rebalancing, as well as distribution of the next listener-triggered indexing, in logs:
- Start the application in dev mode with
./mvnw compile quarkus:dev, or in prod mode withdocker-compose up. - Go to http://localhost:8080/q/swagger-ui/
- Use the endpoints
/author,/author/{id},/book,/book/{id}.
You will see the resulting outbox event processing and Elasticsearch indexing requests in the application logs.
- Go to http://localhost:8080/q/swagger-ui/
- Use the endpoints
/book/searchand/book/search/facets.
- Start the application in dev mode with
./mvnw compile quarkus:dev, or in prod mode withdocker-compose up. - Run
curl -s -XPOST 'localhost:9000/admin/reindex'
Alternatively, in dev mode only:
- Mass indexing, happens automatically on startup.
- To trigger it manually, you can also use the Dev UI:
- Go to http://localhost:8080/q/dev-ui/io.quarkus.quarkus-hibernate-search-orm-elasticsearch/indexed-entity-types
- Select the entity types to reindex and click "Reindex selected"
You can create a native executable using:
./mvnw package -PnativeOr, if you don't have GraalVM installed, you can run the native executable build in a container using:
./mvnw package -Pnative -Dquarkus.native.container-build=trueYou can then execute your native executable with: ./target/hsearch-outbox-polling-1.0.0-SNAPSHOT-runner
If you want to learn more about building native executables, please consult https://quarkus.io/guides/maven-tooling.
- Hibernate ORM with Panache (guide): Simplify your persistence code for Hibernate ORM via the active record or the repository pattern
- SmallRye Health (guide): Monitor service health
- Hibernate Search + Elasticsearch (guide): Automatically index your Hibernate entities in Elasticsearch
- SmallRye OpenAPI (guide): Document your REST APIs with OpenAPI - comes with Swagger UI
- RESTEasy Reactive (guide): A Jakarta REST implementation utilizing build time processing and Vert.x. This extension is not compatible with the quarkus-resteasy extension, or any of the extensions that depend on it.
- JDBC Driver - PostgreSQL (guide): Connect to the PostgreSQL database via JDBC
