Class HealthMetaDataProducer
java.lang.Object
com.kingsrook.qqq.backend.core.model.metadata.MetaDataProducer<QJavalinMetaData>
com.kingsrook.qqq.middleware.health.HealthMetaDataProducer
- All Implemented Interfaces:
MetaDataProducerInterface<QJavalinMetaData>
MetaData producer for health check configuration.
This producer demonstrates the recommended pattern for auto-registering
health endpoints via metadata. Applications can extend this class and
override the produce() method to customize health indicator configuration.
Example usage:
public class MyHealthMetaDataProducer extends HealthMetaDataProducer
{
@Override
protected HealthCheckMetaData buildHealthCheckMetaData(QInstance qInstance)
{
return new HealthCheckMetaData()
.withEnabled(true)
.withEndpointPath("/health")
.withIndicators(List.of(
new DatabaseHealthIndicator().withBackendName("rdbms"),
new MemoryHealthIndicator().withThreshold(85)
));
}
}
-
Field Summary
Fields inherited from interface com.kingsrook.qqq.backend.core.model.metadata.MetaDataProducerInterface
DEFAULT_SORT_ORDER -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected HealthCheckMetaDatabuildHealthCheckMetaData(QInstance qInstance) Build the HealthCheckMetaData configuration.Produce QJavalinMetaData with health check configuration and auto-register the JavalinHealthRouteProvider.Methods inherited from class com.kingsrook.qqq.backend.core.model.metadata.MetaDataProducer
getSourceClass, setSourceClass, withSourceClassMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.kingsrook.qqq.backend.core.model.metadata.MetaDataProducerInterface
getSortOrder, isEnabled
-
Constructor Details
-
HealthMetaDataProducer
public HealthMetaDataProducer()
-
-
Method Details
-
produce
Produce QJavalinMetaData with health check configuration and auto-register the JavalinHealthRouteProvider. This method performs two key operations: 1. Adds HealthCheckMetaData to QInstance supplemental metadata 2. Registers JavalinHealthRouteProvider reference for auto-loading Applications should override buildHealthCheckMetaData() to customize health indicator configuration.- Throws:
QException
-
buildHealthCheckMetaData
Build the HealthCheckMetaData configuration. Override this method in application-specific subclasses to customize health indicators, endpoint path, timeouts, and other configuration. Default implementation returns null (no health endpoints). Applications must override to enable health checks.- Parameters:
qInstance- the QInstance being configured- Returns:
- HealthCheckMetaData configuration, or null to disable health checks
- Throws:
QException
-