in extensions/microprofile-health/deployment/src/main/java/org/apache/camel/quarkus/component/microprofile/health/deployment/MicroProfileHealthProcessor.java [105:150]
List<CamelBeanBuildItem> camelHealthDiscovery(CombinedIndexBuildItem combinedIndex) {
IndexView index = combinedIndex.getIndex();
List<CamelBeanBuildItem> buildItems = new ArrayList<>();
Collection<ClassInfo> healthChecks = index.getAllKnownImplementors(CAMEL_HEALTH_CHECK_DOTNAME);
Collection<ClassInfo> healthCheckRepositories = index
.getAllKnownImplementors(CAMEL_HEALTH_CHECK_REPOSITORY_DOTNAME);
Config config = ConfigProvider.getConfig();
Predicate<ClassInfo> healthCheckFilter = classInfo -> {
String className = classInfo.name().toString();
if (className.equals(HealthCheckRegistryRepository.class.getName())) {
// HealthCheckRegistryRepository is created internally by Camel
return false;
}
if (className.equals(RoutesHealthCheckRepository.class.getName())) {
return config.getOptionalValue("camel.health.routesEnabled", boolean.class).orElse(true);
}
if (className.equals(ConsumersHealthCheckRepository.class.getName())) {
return config.getOptionalValue("camel.health.consumersEnabled", boolean.class).orElse(true);
}
return true;
};
// Create CamelBeanBuildItem to bind instances of HealthCheck to the camel registry
healthChecks.stream()
.filter(CamelSupport::isConcrete)
.filter(CamelSupport::isPublic)
.filter(ClassInfo::hasNoArgsConstructor)
.filter(healthCheckFilter)
.map(this::createHealthCamelBeanBuildItem)
.forEach(buildItems::add);
// Create CamelBeanBuildItem to bind instances of HealthCheckRepository to the camel registry
healthCheckRepositories.stream()
.filter(CamelSupport::isConcrete)
.filter(CamelSupport::isPublic)
.filter(ClassInfo::hasNoArgsConstructor)
.filter(healthCheckFilter)
.map(this::createHealthCamelBeanBuildItem)
.forEach(buildItems::add);
return buildItems;
}