Sample project to assist with line/armeria#4396
- Install SDKMAN
curl -s "https://get.sdkman.io" | bash
source "$HOME/.sdkman/bin/sdkman-init.sh"
- Install JDK17
sdk install java 17.0.4-tem
- Run Application
./gradlew bootRun -Parmeria
NOTE: bootRun
without -Parmeria
will exclude com.linecorp.armeria:armeria-spring-boot2-actuator-starter
and
use org.springframework.boot:spring-boot-starter-actuator
instead.
- Get application health
curl http://localhost:8080/actuator/health
When the com.linecorp.armeria:armeria-spring-boot2-actuator-starter
dependency is included, the result
from /actuator/health
will always be HTTP 200
with the following response body:
{
"scanAvailable": true
}
Log statements showing that CustomHealthIndicator#doHealthCheck
was invoked will appear in app logs, however the log
statements within the Mono<Health>
returned from CustomHealthIndicator#doHealthCheck
do not. This indicates that
the Mono<Health>
returned from CustomHealthIndicator#doHealthCheck
never received a subscription and the custom
health check logic was not invoked.
When excluding com.linecorp.armeria:armeria-spring-boot2-actuator-starter
, the log statements within
the Mono<Health>
returned from CustomHealthIndicator#doHealthCheck
appear in the app logs and a random, simulated
health is returned from /actuator/health
:
- When
r.nextBoolean() == true
:- Status Code:
HTTP 200
- Response Body:
{"status": "UP"}
- Status Code:
- When
r.nextBoolean() == false
:- Status Code:
HTTP 503
- Response Body:
{"status": "DOWN"}
- Status Code: