Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make minor improvements to CDI handling of AsyncHealthCheckFactory #35675

Merged
merged 1 commit into from
Sep 1, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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