All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.quarkiverse.opensearch.restclient.lowlevel.deployment.OpenSearchRestClientProcessor Maven / Gradle / Ivy

There is a newer version: 1.13.0
Show newest version
package io.quarkiverse.opensearch.restclient.lowlevel.deployment;

import org.jboss.jandex.DotName;

import io.quarkiverse.opensearch.deployment.OpenSearchBuildTimeConfig;
import io.quarkiverse.opensearch.restclient.OpenSearchClientConfig;
import io.quarkiverse.opensearch.restclient.lowlevel.runtime.OpenSearchRestClientProducer;
import io.quarkiverse.opensearch.restclient.lowlevel.runtime.health.OpenSearchHealthCheck;
import io.quarkus.arc.deployment.AdditionalBeanBuildItem;
import io.quarkus.arc.deployment.BeanDefiningAnnotationBuildItem;
import io.quarkus.arc.processor.DotNames;
import io.quarkus.deployment.annotations.BuildProducer;
import io.quarkus.deployment.annotations.BuildStep;
import io.quarkus.deployment.builditem.FeatureBuildItem;
import io.quarkus.smallrye.health.deployment.spi.HealthBuildItem;

class OpenSearchRestClientProcessor {
    static final String FEATURE = "opensearch-rest-client";
    private static final DotName OPENSEARCH_CLIENT_CONFIG = DotName.createSimple(OpenSearchClientConfig.class.getName());

    @BuildStep
    FeatureBuildItem feature() {
        return new FeatureBuildItem(FEATURE);
    }

    @BuildStep
    AdditionalBeanBuildItem build() {
        return AdditionalBeanBuildItem.unremovableOf(OpenSearchRestClientProducer.class);
    }

    @BuildStep
    void openSearchClientConfigSupport(BuildProducer additionalBeans,
            BuildProducer beanDefiningAnnotations) {
        // add the @OpenSearchClientConfig class otherwise it won't be registered as a qualifier
        additionalBeans.produce(AdditionalBeanBuildItem.builder().addBeanClass(OpenSearchClientConfig.class).build());

        beanDefiningAnnotations
                .produce(new BeanDefiningAnnotationBuildItem(OPENSEARCH_CLIENT_CONFIG, DotNames.APPLICATION_SCOPED, false));
    }

    @BuildStep
    HealthBuildItem addHealthCheck(OpenSearchBuildTimeConfig buildTimeConfig) {
        return new HealthBuildItem(OpenSearchHealthCheck.class.getName(),
                buildTimeConfig.healthEnabled);
    }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy