5.9. Health Check URL
Every application block deployed as a web application provides a health check URL. An HTTP GET request for this URL returns ok
if the block is ready to work.
The URL paths for different blocks are listed below:
-
Middleware:
/remoting/health
-
Web Client:
/dispatch/health
-
Web Portal:
/rest/health
(requires REST API add-on)
So for an application named app
and deployed at localhost:8080
the URLs will be:
-
http://localhost:8080/app-core/remoting/health
-
http://localhost:8080/app/dispatch/health
-
http://localhost:8080/app-portal/rest/health
You can replace ok
in response with any text using the cuba.healthCheckResponse application property.
The health check controllers also send an application event of type HealthCheckEvent
. Therefore you can add your own logic of checking the application health. In the example on GitHub, a bean of the web tier listens to the health check events and invokes a middleware service, which in turn executes an operation on the database.