This folder contains the Java modules for MyServiceBus. The Gradle multi-project build resides at the repository root.
- JDK 17 (Temurin/OpenJDK recommended)
- Gradle
- Docker (optional) to run RabbitMQ locally
If the Gradle wrapper JAR is missing, bootstrap it from the repository root:
gradle wrapper- From the repository root, build all modules and run tests:
./gradlew test
From the repository root, start RabbitMQ using Docker Compose:
docker compose up -d rabbitmqRabbitMQ defaults: host localhost, port 5672, mgmt UI http://localhost:15672 (guest/guest).
- From the module directory:
cd src/Java/testapp RABBITMQ_HOST=localhost HTTP_PORT=5301 ../../gradlew run - From the repo root (no
cdrequired):RABBITMQ_HOST=localhost HTTP_PORT=5301 ./gradlew -p src/Java/testapp run
Helper script (equivalent):
cd src/Java/testapp
RABBITMQ_HOST=localhost HTTP_PORT=5301 ./run.shThe app starts an HTTP server (default port 5301) with routes:
GET /publish– publishes SubmitOrderGET /send– sends SubmitOrder to a queueGET /request– request/response demoGET /request_multi– request/response with Fault handling`
Run multiple instances by changing HTTP_PORT (e.g., 5301 and 5302).
RABBITMQ_HOST: RabbitMQ host (defaultlocalhost)HTTP_PORT: HTTP port for testapp (default5301)
To run the Java test app under Aspire, two things must be true:
- The OpenTelemetry Java agent JAR must exist at
src/AspireApp/agents/opentelemetry-javaagent.jar. - A trusted Aspire OTLP certificate PEM must exist at
src/AspireApp/agents/aspire-localhost-cert.pem. - The test app JAR must be built before the AppHost starts.
Build the executable JAR from the repository root:
./gradlew :testapp:jarSet up the Java agent:
mkdir -p src/AspireApp/agents
curl -fL \
https://github.com/open-telemetry/opentelemetry-java-instrumentation/releases/latest/download/opentelemetry-javaagent.jar \
-o src/AspireApp/agents/opentelemetry-javaagent.jarThe AppHost also configures the Java agent to trust a local Aspire OTLP certificate PEM at:
src/AspireApp/agents/aspire-localhost-cert.pem
Then start Aspire:
dotnet run --project src/AspireApp/AspireApp.csprojAdditional details are documented in docs/development/aspire-java-telemetry.md.
See also: docs/two-service-sample.md for running .NET and Java together.
- Lombok is configured as an annotation processor via the root
build.gradleand does not need to be added per-module. - Modules and external dependency versions are centralized in the root
build.gradle.