https://github.com/starichkov/quarkus-micro-service
Quarkus framework based example of the micro-service with HTTP endpoints (often called as REST) and multiple additional features.
https://github.com/starichkov/quarkus-micro-service
docker docker-compose java microservices quarkus quarkusio redis
Last synced: 3 months ago
JSON representation
Quarkus framework based example of the micro-service with HTTP endpoints (often called as REST) and multiple additional features.
- Host: GitHub
- URL: https://github.com/starichkov/quarkus-micro-service
- Owner: starichkov
- License: mit
- Created: 2021-08-03T08:38:04.000Z (almost 5 years ago)
- Default Branch: main
- Last Pushed: 2025-02-22T11:49:53.000Z (over 1 year ago)
- Last Synced: 2025-02-22T12:28:26.972Z (over 1 year ago)
- Topics: docker, docker-compose, java, microservices, quarkus, quarkusio, redis
- Language: Java
- Homepage:
- Size: 252 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 6
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
[](https://github.com/starichkov/quarkus-micro-service/actions/workflows/maven.yml)
[](https://codecov.io/gh/starichkov/quarkus-micro-service)
[](https://github.com/starichkov/quarkus-micro-service/blob/main/LICENSE.md)
Quarkus microservice
=
This project is a Quarkus framework based, 'ready-to-play' micro-service.
| Name | Version |
|----------------|---------|
| Java | 25 |
| Maven | 3.8.1+ |
| Quarkus | 3.33.1 |
| PostgreSQL | 17.6 |
| Valkey | 7.2.10 |
| Testcontainers | 2.0.x |
## What's inside?
Starting from Quarkus `3.20.x` this project `main` branch will be using only LTS version.
Separate `edge` branch will be using latest versions, and when it will reach next LTS one it will be merged to `main`.
### Quarkus extensions-based features
- REST controller with multiple endpoints ([official guide](https://quarkus.io/guides/rest-json))
- JSON serialisation using Jackson
- YAML-based configuration ([official guide](https://quarkus.io/guides/config-yaml))
- Database with Flyway migration support ([official guide](https://quarkus.io/guides/flyway))
- H2 database for test scope
- Health check endpoints ([official guide](https://quarkus.io/guides/smallrye-health))
- Scheduled tasks configured to use Unix [Crontab](https://crontab.guru/) syntax ([official guide](https://quarkus.io/guides/scheduler-reference))
- Redis/Valkey client with health indicator ([official guide](https://quarkus.io/guides/redis))
- OpenTelemetry support ([official guide](https://quarkus.io/guides/opentelemetry))
- EventBus (alternative to Spring's ApplicationEvent system, [official guide](https://quarkus.io/guides/reactive-event-bus))
- Qute templating engine (special-for-Quarkus alternative to Freemarker or Mustache engines, [official guide](https://quarkus.io/guides/qute-reference))
This service contains multiple features which requires some specific servers to be available and resolvable:
| Feature | Requirement | How to run in Docker | How to disable |
|---------------|---------------|--------------------------------------------|------------------------------------|
| Database | PostgreSQL | [postgres.md](/documentation/postgres.md) | - required - |
| Valkey | Valkey server | [valkey.md](/documentation/valkey.md) | |
| OpenTelemetry | Jaeger server | [jaeger.md](/documentation/jaeger.md) | |
| Metrics | Prometheus | [metrics.md](/documentation/prometheus.md) | `quarkus.micrometer.enabled=false` |
#### Health check
These endpoints are available via following URLs:
```
GET http://localhost:8080/q/health
GET http://localhost:8080/q/health/live
GET http://localhost:8080/q/health/ready
```
Also, there is Health UI provided too:
```
http://localhost:8080/q/health-ui/
```
### Docker
This service contains two Dockerfile-s, [more details](/documentation/docker.md) on the separate page.
### 3rd party libraries features
- Lombok + Mapstruct (with Mapstruct's CDI mode)
## What's the plan?
List of features I am planning to add:
- Async controller endpoints
- Hibernate ORM with Panache ([official guide](https://quarkus.io/guides/hibernate-orm-panache))
- WebSocket support
- AMPQ support
- Migrate to multi-module Maven project
- Native Build with GraalVM
## Native executable with GraalVM
### Build
```shell
mvn clean verify -Dnative
```
#### Dependencies
```shell
sudo apt install zlib1g-dev
```
### Run
```shell
export DB_USERNAME=...
export DB_PASSWORD=...
./target/quarkus-micro-service-1.0.0-runner
```
## Limitations found
Quarkus does not support/provide:
- Redis as a persistence layer for caching extension. It means you can't use Quarkus `@Cache**` annotations with underlying Redis.
And Quarkus itself will not allow to implement such layer easily - caching extension does not accept custom `CacheManager` or cache types.
- AOP (AspectJ) as Spring does. Partially similar behavior could be achieved via Interceptors, but it is still quite a different thing...
## License
See the [LICENSE](LICENSE.md) file for license rights and limitations (MIT).