This project uses Quarkus, the Supersonic Subatomic Java Framework.
If you want to learn more about Quarkus, please visit its website: https://quarkus.io/ .
Run docker compose up -d. If the container is ready, start the application with
./gradlew quarkusDev. The application should be available under localhost:8084.
Authentication is disabled by default. To enable it, set QUARKUS_OIDC_ENABLED=true when starting
the service and point QUARKUS_OIDC_AUTH_SERVER_URL and QUARKUS_OIDC_TOKEN_ISSUER to the Keycloak
realm. Do not set QUARKUS_OIDC_ENABLED=false while building: Quarkus evaluates this
variable at build time, too, and would remove OIDC support from the resulting artifact.
Every change of a landscape token is published to the Kafka topic tokens.events, see
token_event.proto. The record key is the token value and deletions
are tombstones, i.e. records without a value. Pending events are stored in the token's document in
MongoDB until they are published, so they are not lost if Kafka is unavailable or the service stops.
Events of a token are published in order and at least once. Hence, consumers have to tolerate
repeated events.
Deleting a token also deletes the snapshots which its owner created of the landscape. Snapshots of other users are kept.
GET /snapshot returns the personal, shared, and subscribed snapshots of a user, newest first. Use the
query parameters size and page (starting at 0) to get only a part of each of the three lists, e.g.
?size=20&page=1. A list with fewer than size entries has no further pages. Without size,
complete lists are returned.
The service creates unique indexes at startup. Redundant copies in existing data are deleted. If there are documents with the same key but different contents, an error is logged and the respective index is not unique until the duplicates are removed and the service is restarted.
- Java 25 (JDK; Gradle downloads it automatically if missing)
- Use the included Gradle 9.7 wrapper (
./gradlew) - A running Docker-compatible container runtime for integration tests
- Make sure to run the ExplorViz software stack before starting the service, as it provides the required database(s) and the Kafka broker
Run the unit tests with ./gradlew test and the integration tests with
./gradlew integrationTest. Integration tests start their own Kafka and MongoDB
containers through Testcontainers; no separately running ExplorViz stack is needed.
./gradlew check runs both test suites and the code-analysis checks.
The Quarkus 3.40.1.1 LTS BOM manages the Testcontainers and Docker client versions.
You can run your application in dev mode that enables live coding using:
./gradlew quarkusDevThis also enables the dev configuration profile, i.e. using the properties prefixed with %dev from
src/main/resources/application.properties.
The application can be packaged and tested using:
./gradlew buildIt produces the quarkus-run.jar file in the build/quarkus-app/ directory.
You can skip running the integration tests by adding -x integrationTest. To skip all tests and code analysis use the assemble task
instead of build.
The application is now runnable using java -jar build/quarkus-app/quarkus-run.jar.
Be aware that it’s not an über-jar as the dependencies are copied into the build/quarkus-app/lib/ directory.
If you want to build an über-jar, which includes the entire application in a single jar file, execute the following command:
./gradlew build -Dquarkus.package.jar.type=uber-jarThe application, packaged as an über-jar, is now runnable using
java -jar build/user-service-1.0-SNAPSHOT-runner.jar.
You can add -Dquarkus.profile=dev to enable the %dev properties.
You can create a native executable using:
./gradlew build -Dquarkus.native.enabled=true -Dquarkus.package.jar.enabled=falseOr, if you don't have GraalVM installed, you can run the native executable build in a container using:
./gradlew build -Dquarkus.native.enabled=true -Dquarkus.package.jar.enabled=false -Dquarkus.native.container-build=trueYou can then execute your native executable with: ./build/user-service-1.0-SNAPSHOT-runner
If you want to learn more about building native executables, please consult https://quarkus.io/guides/gradle-tooling#building-a-native-executable.