Skip to content

Commit

Permalink
Merge pull request #35675 from geoand/health-beans
Browse files Browse the repository at this point in the history
Make minor improvements to CDI handling of AsyncHealthCheckFactory
  • Loading branch information
geoand authored Sep 1, 2023
2 parents 93b5c69 + 9fd055c commit 632f571
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
import io.quarkus.arc.deployment.AdditionalBeanBuildItem;
import io.quarkus.arc.deployment.BeanArchiveIndexBuildItem;
import io.quarkus.arc.deployment.BeanDefiningAnnotationBuildItem;
import io.quarkus.arc.deployment.ExcludedTypeBuildItem;
import io.quarkus.arc.deployment.SyntheticBeansRuntimeInitBuildItem;
import io.quarkus.arc.processor.BuiltinScope;
import io.quarkus.deployment.Capabilities;
Expand Down Expand Up @@ -71,6 +72,7 @@
import io.quarkus.vertx.http.deployment.webjar.WebJarResourcesFilter;
import io.quarkus.vertx.http.deployment.webjar.WebJarResultsBuildItem;
import io.quarkus.vertx.http.runtime.management.ManagementInterfaceBuildTimeConfig;
import io.smallrye.health.AsyncHealthCheckFactory;
import io.smallrye.health.SmallRyeHealthReporter;
import io.smallrye.health.api.HealthGroup;
import io.smallrye.health.api.HealthGroups;
Expand Down Expand Up @@ -154,6 +156,7 @@ void healthCheck(BuildProducer<AdditionalBeanBuildItem> buildItemBuildProducer,
@SuppressWarnings("unchecked")
void build(SmallRyeHealthRecorder recorder,
BuildProducer<FeatureBuildItem> feature,
BuildProducer<ExcludedTypeBuildItem> excludedTypes,
BuildProducer<AdditionalBeanBuildItem> additionalBean,
BuildProducer<BeanDefiningAnnotationBuildItem> beanDefiningAnnotation)
throws IOException, ClassNotFoundException {
Expand All @@ -171,6 +174,7 @@ void build(SmallRyeHealthRecorder recorder,

// Add additional beans
additionalBean.produce(new AdditionalBeanBuildItem(QuarkusAsyncHealthCheckFactory.class));
excludedTypes.produce(new ExcludedTypeBuildItem(AsyncHealthCheckFactory.class.getName()));
additionalBean.produce(new AdditionalBeanBuildItem(SmallRyeHealthReporter.class));

// Make ArC discover @HealthGroup as a qualifier
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
package io.quarkus.smallrye.health.runtime;

import jakarta.annotation.Priority;
import jakarta.enterprise.context.ApplicationScoped;
import jakarta.enterprise.inject.Alternative;
import jakarta.inject.Inject;
import jakarta.inject.Singleton;

import org.eclipse.microprofile.health.HealthCheck;
import org.eclipse.microprofile.health.HealthCheckResponse;
Expand All @@ -19,13 +16,14 @@
* Quarkus specific health check factory that runs blocking and reactive
* health checks with different executors provided by {@link MutinyHelper}.
*/
@ApplicationScoped
@Alternative
@Priority(1)
@Singleton
public class QuarkusAsyncHealthCheckFactory extends AsyncHealthCheckFactory {

@Inject
Vertx vertx;
private final Vertx vertx;

public QuarkusAsyncHealthCheckFactory(Vertx vertx) {
this.vertx = vertx;
}

@Override
public Uni<HealthCheckResponse> callSync(HealthCheck healthCheck) {
Expand Down

0 comments on commit 632f571

Please sign in to comment.